/**
 * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springblade.oa.service.impl;

import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import lombok.AllArgsConstructor;
import org.apache.commons.io.CopyUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.oa.entity.Bx;
import org.springblade.oa.entity.Bxxcmx;
import org.springblade.oa.mapper.BxMapper;
import org.springblade.oa.service.IBxService;
import org.springblade.oa.vo.*;
import org.springblade.system.feign.IDictClient;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.rmi.server.ExportException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 服务实现类
 *
 * @author Chill
 */
@Service
@AllArgsConstructor
public class BxServiceImpl extends BaseServiceImpl<BxMapper, Bx> implements IBxService {

	BxMapper bxMapper;
	private IDictClient dictClient;

	@Override
	public boolean submit(Bx bx) {
		return saveOrUpdate( bx );
	}

	@Override
	public Integer todayCount(Integer bxdw) {
		Integer num = bxMapper.todayCount( bxdw );
		return num;
	}

	@Override
	public HSSFWorkbook export(List<Map<String, Object>> allBxMapList, HttpServletResponse response) {
		HSSFWorkbook workbook = new HSSFWorkbook();
		//生成一个表格，设置表格名称为"报销单"
		HSSFSheet sheet = workbook.createSheet( "差旅报销单" );
		// 设置列宽
		sheet.setColumnWidth( 0, 2600 );

		HSSFPrintSetup printSetup = sheet.getPrintSetup();
		printSetup.setPaperSize( HSSFPrintSetup.A4_PAPERSIZE ); // 纸张
		sheet.setDisplayGridlines( false );
		sheet.setPrintGridlines( false );
		sheet.setMargin( HSSFSheet.TopMargin, (double) 0.1 ); // 上边距
		sheet.setMargin( HSSFSheet.BottomMargin, (double) 0.1 ); // 下边距
		sheet.setMargin( HSSFSheet.LeftMargin, (double) 0.1 ); // 左边距
		sheet.setMargin( HSSFSheet.RightMargin, (double) 0.1 ); // 右边距

		// 设置字体  20号楷体居中
		HSSFFont headfont = workbook.createFont();
		headfont.setFontName( "楷体" );
		headfont.setFontHeightInPoints( (short) 20 );// 字体大小
		HSSFCellStyle headstyle = workbook.createCellStyle();
		headstyle.setFont( headfont );
		headstyle.setAlignment( HorizontalAlignment.CENTER );//水平居中
		headstyle.setVerticalAlignment( VerticalAlignment.CENTER );//垂直居中
		headstyle.setLocked( true );
		headstyle.setWrapText( true );// 自动换行

		//12号 居中
		HSSFFont columnHeadFont = workbook.createFont();
		columnHeadFont.setFontName( "宋体" );
		columnHeadFont.setFontHeightInPoints( (short) 12 );
		HSSFCellStyle columnHeadStyle = workbook.createCellStyle();
		columnHeadStyle.setFont( columnHeadFont );
		columnHeadStyle.setAlignment( HorizontalAlignment.CENTER );//水平居中
		columnHeadStyle.setVerticalAlignment( VerticalAlignment.CENTER );//垂直居中
		columnHeadStyle.setLocked( true );
		columnHeadStyle.setWrapText( true );
		columnHeadStyle.setBorderBottom( BorderStyle.THIN ); //下边框
		columnHeadStyle.setBorderLeft( BorderStyle.THIN );//左边框
		columnHeadStyle.setBorderTop( BorderStyle.THIN );//上边框
		columnHeadStyle.setBorderRight( BorderStyle.THIN );//右边框

		//10号 居中
		HSSFFont font = workbook.createFont();
		font.setFontName( "宋体" );
		font.setFontHeightInPoints( (short) 10 );
		HSSFCellStyle centerstyle = workbook.createCellStyle();
		centerstyle.setFont( font );
		centerstyle.setAlignment( HorizontalAlignment.CENTER );//水平居中
		centerstyle.setVerticalAlignment( VerticalAlignment.CENTER );//垂直居中
		centerstyle.setWrapText( true );    // 自动换行
		centerstyle.setBorderBottom( BorderStyle.THIN ); //下边框
		centerstyle.setBorderLeft( BorderStyle.THIN );//左边框
		centerstyle.setBorderTop( BorderStyle.THIN );//上边框
		centerstyle.setBorderRight( BorderStyle.THIN );//右边框

		//12号 居左
		HSSFFont liftfont = workbook.createFont();
		liftfont.setFontName( "宋体" );
		liftfont.setFontHeightInPoints( (short) 12 );
		HSSFCellStyle leftstyle = workbook.createCellStyle();
		leftstyle.setFont( liftfont );
		leftstyle.setAlignment( HorizontalAlignment.LEFT );//水平居左
		leftstyle.setVerticalAlignment( VerticalAlignment.CENTER );//垂直居中
		leftstyle.setWrapText( true );
		leftstyle.setBorderBottom( BorderStyle.THIN ); //下边框
		leftstyle.setBorderLeft( BorderStyle.THIN );//左边框
		leftstyle.setBorderTop( BorderStyle.THIN );//上边框
		leftstyle.setBorderRight( BorderStyle.THIN );//右边框
		sheet.setDefaultColumnWidth( 6 );

		//10号 居左
		HSSFFont liftfont10 = workbook.createFont();
		liftfont10.setFontName( "宋体" );
		liftfont10.setFontHeightInPoints( (short) 10 );
		HSSFCellStyle leftstyle10 = workbook.createCellStyle();
		leftstyle10.setFont( liftfont10 );
		leftstyle10.setAlignment( HorizontalAlignment.LEFT );//水平居左
		leftstyle10.setVerticalAlignment( VerticalAlignment.CENTER );//垂直居中
		leftstyle10.setWrapText( true );
		leftstyle10.setBorderBottom( BorderStyle.THIN ); //下边框
		leftstyle10.setBorderLeft( BorderStyle.THIN );//左边框
		leftstyle10.setBorderTop( BorderStyle.THIN );//上边框
		leftstyle10.setBorderRight( BorderStyle.THIN );//右边框
		sheet.setDefaultColumnWidth( 6 );

		//10号 居右
		HSSFFont rightfont10 = workbook.createFont();
		rightfont10.setFontName( "宋体" );
		rightfont10.setFontHeightInPoints( (short) 10 );
		HSSFCellStyle rightstyle10 = workbook.createCellStyle();
		rightstyle10.setFont( rightfont10 );
		rightstyle10.setAlignment( HorizontalAlignment.RIGHT );//水平居右
		rightstyle10.setVerticalAlignment( VerticalAlignment.CENTER );//垂直居中
		rightstyle10.setWrapText( true );
		rightstyle10.setBorderBottom( BorderStyle.THIN ); //下边框
		rightstyle10.setBorderLeft( BorderStyle.THIN );//左边框
		rightstyle10.setBorderTop( BorderStyle.THIN );//上边框
		rightstyle10.setBorderRight( BorderStyle.THIN );//右边框
		sheet.setDefaultColumnWidth( 6 );


//		循环list
		Integer fyLength = 6;//费用报销单list的默认长度，最少5行
		Integer jtLength = 5;//差旅报销单交通费的默认长度
		Integer zsLength = 3;//差旅报销单住宿费的默认长度
		Integer btLength = 3;//差旅报销单补贴费的默认长度
		Integer qtLength = 1;//差旅报销单其他费的默认长度
		Integer num = 0;//单据起始行数
		for (int i = 0; i < allBxMapList.size(); i++) {
			BxVo bxVo = (BxVo) allBxMapList.get( i ).get( "bx" );
			List<BxxcmxVO> bxxcmxVOList = (List<BxxcmxVO>) allBxMapList.get( i ).get( "bxxcmxList" );
			List<BxfymxVO> bxfymxVOList = (List<BxfymxVO>) allBxMapList.get( i ).get( "bxfymxList" );
			List<BxfymxVO> bxTbfymxVOList = deepCopyList( bxfymxVOList );
			List<BxfymxVO> list = new ArrayList<>();
			List<BxfymxVO> tblist = new ArrayList<>();
			if (bxfymxVOList != null && bxfymxVOList.size() > 1) {
				for (int k = 0; k < bxfymxVOList.size(); k++) {//合并发票金额
					if (k == 0) {
						BxfymxVO z1 = new BxfymxVO();
						z1.setFylxName( bxfymxVOList.get( k ).getFylxName() );
						z1.setFybxdje( bxfymxVOList.get( k ).getFybxdje() );
						z1.setXmbh(bxfymxVOList.get(k).getXmbh());
						z1.setXmbhName(bxfymxVOList.get(k).getXmbhName());
						z1.setXmbhAbbName(bxfymxVOList.get(k).getXmbhAbbName());
						list.add( z1 );
						k++;
					}
					for (int j = 0; j < list.size(); j++) {
						if (bxfymxVOList.get( k ).getFylxName().equals( list.get( j ).getFylxName() )) {
							BigDecimal a = bxfymxVOList.get( k ).getFybxdje().add( list.get( j ).getFybxdje() );
							list.get( j ).setFybxdje( a );
						} else {
							Boolean b = false;
							for (int j1 = 0; j1 < list.size(); j1++) {
								if (list.get( j1 ).getFylxName().equals( bxfymxVOList.get( k ).getFylxName() )) {
									b = true;
								}
							}
							if (b == false) {
								BxfymxVO z1 = new BxfymxVO();
								z1.setFylxName( bxfymxVOList.get( k ).getFylxName() );
								z1.setFybxdje( bxfymxVOList.get( k ).getFybxdje() );
								z1.setXmbh(bxfymxVOList.get(k).getXmbh());
								z1.setXmbhName(bxfymxVOList.get(k).getXmbhName());
								z1.setXmbhAbbName(bxfymxVOList.get(k).getXmbhAbbName());
								bxfymxVOList.remove( k );
								k--;
								list.add( z1 );
							}
						}
					}
				}
				if (bxTbfymxVOList.get( 0 ).getTbfylxName() != null) {
					for (int k = 0; k < bxTbfymxVOList.size(); k++) {//合并替补发票金额
						if (k == 0) {
							BxfymxVO z1 = new BxfymxVO();
							z1.setTbfylxName( bxTbfymxVOList.get( k ).getTbfylxName() );
							z1.setTbfybxdje( bxTbfymxVOList.get( k ).getTbfybxdje() );
							z1.setXmbh(bxTbfymxVOList.get(k).getXmbh());
							z1.setXmbhName(bxTbfymxVOList.get(k).getXmbhName());
							z1.setXmbhAbbName(bxTbfymxVOList.get(k).getXmbhAbbName());
							tblist.add( z1 );
							k++;
						}
						for (int j = 0; j < tblist.size(); j++) {
							if (bxTbfymxVOList.get( k ).getTbfylxName().equals( tblist.get( j ).getTbfylxName() )) {
								BigDecimal a = bxTbfymxVOList.get( k ).getTbfybxdje().add( tblist.get( j ).getTbfybxdje() );
								tblist.get( j ).setTbfybxdje( a );
							} else {
								Boolean b = false;
								for (int j1 = 0; j1 < tblist.size(); j1++) {
									if (tblist.get( j1 ).getTbfylxName().equals( bxTbfymxVOList.get( k ).getTbfylxName() )) {
										b = true;
									}
								}
								if (b == false) {
									BxfymxVO z1 = new BxfymxVO();
									z1.setTbfylxName( bxTbfymxVOList.get( k ).getTbfylxName() );
									z1.setTbfybxdje( bxTbfymxVOList.get( k ).getTbfybxdje() );
									z1.setXmbh(bxTbfymxVOList.get(k).getXmbh());
									z1.setXmbhName(bxTbfymxVOList.get(k).getXmbhName());
									z1.setXmbhAbbName(bxTbfymxVOList.get(k).getXmbhAbbName());
									bxTbfymxVOList.remove( k );
									k--;
									tblist.add( z1 );
								}
							}
						}
					}
				} else {
					for (int k = 0; k < bxTbfymxVOList.size(); k++) {//合并替补发票金额
						if (k == 0) {
							BxfymxVO z1 = new BxfymxVO();
							z1.setTbfylxName( bxTbfymxVOList.get( k ).getFylxName() );
							z1.setTbfybxdje( bxTbfymxVOList.get( k ).getFybxdje() );
							z1.setXmbh(bxTbfymxVOList.get(k).getXmbh());
							z1.setXmbhName(bxTbfymxVOList.get(k).getXmbhName());
							z1.setXmbhAbbName(bxTbfymxVOList.get(k).getXmbhAbbName());
							tblist.add( z1 );
							k++;
						}
						for (int j = 0; j < tblist.size(); j++) {
							if (bxTbfymxVOList.get( k ).getFylxName().equals( tblist.get( j ).getTbfylxName() )) {
								BigDecimal a = bxTbfymxVOList.get( k ).getFybxdje().add( tblist.get( j ).getTbfybxdje() );
								tblist.get( j ).setTbfybxdje( a );
							} else {
								Boolean b = false;
								for (int j1 = 0; j1 < tblist.size(); j1++) {
									if (tblist.get( j1 ).getTbfylxName().equals( bxTbfymxVOList.get( k ).getFylxName() )) {
										b = true;
									}
								}
								if (b == false) {
									BxfymxVO z1 = new BxfymxVO();
									z1.setTbfylxName( bxTbfymxVOList.get( k ).getFylxName() );
									z1.setTbfybxdje( bxTbfymxVOList.get( k ).getFybxdje() );
									z1.setXmbh(bxTbfymxVOList.get(k).getXmbh());
									z1.setXmbhName(bxTbfymxVOList.get(k).getXmbhName());
									z1.setXmbhAbbName(bxTbfymxVOList.get(k).getXmbhAbbName());
									bxTbfymxVOList.remove( k );
									k--;
									tblist.add( z1 );
								}
							}
						}
					}
				}
			} else {
				list = deepCopyList( bxfymxVOList );
				tblist = deepCopyList( bxfymxVOList );
			}
			List<BxzszpmxVO> bxzszpmxVOList = (List<BxzszpmxVO>) allBxMapList.get( i ).get( "bxzszpmxList" );
			Integer bxlx = Integer.parseInt( allBxMapList.get( i ).get( "bxlx" ).toString() );
			if (bxlx == 1) {//差旅
				num = addxcbxd( bxVo, bxxcmxVOList, num, jtLength, zsLength, btLength, qtLength, sheet, headstyle, centerstyle, leftstyle, columnHeadStyle, leftstyle10, rightstyle10 );//新增差旅报销单
				num = num + 1;
			} else if (bxlx == 2) {//费用
				Integer fplx = bxfymxVOList.get( 0 ).getFplx();//（有票无票 1有票 0无票）
				if (fplx == 0) {
					num = addfybxd( bxVo, list, num, fyLength, sheet, headstyle, centerstyle, leftstyle, columnHeadStyle, 0, leftstyle10, -1 );//费用报销单 bxnum起始行
					num = num + 1;
					num = addfybxd( bxVo, tblist, num, fyLength, sheet, headstyle, centerstyle, leftstyle, columnHeadStyle, 1, leftstyle10, -1 );//费用报销单 bxnum起始行
					num = num + 1;
				} else {
					bxVo.setTbbxzjedx(bxVo.getBxzjedx());
					num = addfybxd( bxVo, tblist, num, fyLength, sheet, headstyle, centerstyle, leftstyle, columnHeadStyle, 1, leftstyle10, 1 );//费用报销单 bxnum起始行
					num = num + 1;
				}
			} else if (bxlx == 3) {//住宿
				num = addzszpbxd( bxVo, bxzszpmxVOList, num, fyLength, sheet, headstyle, centerstyle, leftstyle, columnHeadStyle, leftstyle10 );//费用报销单 bxnum起始行
				num = num + 1;
			}
		}
		return workbook;
	}

	/**
	 * @param num         从第几行开始
	 * @param sheet
	 * @param headstyle
	 * @param centerstyle
	 */
	private Integer addxcbxd(BxVo bxvo, List<BxxcmxVO> bxxcmxVOList, Integer num, Integer jtLength,
							 Integer zsLength, Integer btLength, Integer qtLength, HSSFSheet sheet,
							 HSSFCellStyle headstyle, HSSFCellStyle centerstyle, HSSFCellStyle leftstyle,
							 HSSFCellStyle columnHeadStyle, HSSFCellStyle leftstyle10, HSSFCellStyle rightstyle10) {
		SimpleDateFormat yymmdd = new SimpleDateFormat( "yyyy-MM-dd" );
		SimpleDateFormat mmdd = new SimpleDateFormat( "MM月dd日" );
		String bxrq = bxvo.getBxrq() == null ? "" : yymmdd.format( bxvo.getBxrq() );
		//创建第一行表头
		//**********************头部***************************************************************
		Integer dexnum = num;
		String xmbh = bxxcmxVOList.stream().map( p -> p.getXmbh() ).distinct().collect( Collectors.joining( "," ) );
		String xmmc = bxxcmxVOList.stream().map( p -> p.getXmbhAbbName() == null ? "": p.getXmbhAbbName() ).distinct().collect( Collectors.joining( "," ) );
		HSSFRow row0 = sheet.createRow( num + 1 );// 创建第一行无数据行
		if (dexnum > 1 && dexnum % 2 == 0) {
			row0.setHeight( (short) 1478 );// 设置行高
		} else {
			row0.setHeight( (short) 526 );// 设置行高
		}
		HSSFRow row1 = sheet.createRow( num + 1 );// 创建第一行
		row1.setHeight( (short) 650 );// 设置行高
		HSSFCell cell0 = row1.createCell( 0 );
		cell0.setCellValue( new HSSFRichTextString( "差旅费报销单" ) );
		cell0.setCellStyle( headstyle );
		HSSFCell cell01 = row1.createCell( 1 );
		cell01.setCellValue( new HSSFRichTextString( "" ) );
		cell01.setCellStyle( headstyle );
		HSSFCell cell02 = row1.createCell( 2 );
		cell02.setCellValue( new HSSFRichTextString( "" ) );
		cell02.setCellStyle( headstyle );
		HSSFCell cell03 = row1.createCell( 3 );
		cell03.setCellValue( new HSSFRichTextString( "" ) );
		cell03.setCellStyle( headstyle );
		HSSFCell cell04 = row1.createCell( 4 );
		cell04.setCellValue( new HSSFRichTextString( "" ) );
		cell04.setCellStyle( headstyle );
		HSSFCell cell05 = row1.createCell( 5 );
		cell05.setCellValue( new HSSFRichTextString( "" ) );
		cell05.setCellStyle( headstyle );
		HSSFCell cell06 = row1.createCell( 6 );
		cell06.setCellValue( new HSSFRichTextString( "" ) );
		cell06.setCellStyle( headstyle );
		HSSFCell cell07 = row1.createCell( 7 );
		cell07.setCellValue( new HSSFRichTextString( "" ) );
		cell07.setCellStyle( headstyle );
		HSSFCell cell08 = row1.createCell( 8 );
		cell08.setCellValue( new HSSFRichTextString( "" ) );
		cell08.setCellStyle( headstyle );
		HSSFCell cell09 = row1.createCell( 9 );
		cell09.setCellValue( new HSSFRichTextString( "" ) );
		cell09.setCellStyle( headstyle );
		HSSFCell cell10 = row1.createCell( 10 );
		cell10.setCellValue( new HSSFRichTextString( "" ) );
		cell10.setCellStyle( headstyle );
		HSSFCell cell11 = row1.createCell( 11 );
		cell11.setCellValue( new HSSFRichTextString( "" ) );
		cell11.setCellStyle( headstyle );
		HSSFCell cell12 = row1.createCell( 12 );
		cell12.setCellValue( new HSSFRichTextString( "" ) );
		cell12.setCellStyle( headstyle );
		HSSFCell cell13 = row1.createCell( 13 );
		cell13.setCellValue( new HSSFRichTextString( "" ) );
		cell13.setCellStyle( headstyle );
		HSSFCell cell14 = row1.createCell( 14 );
		cell14.setCellValue( new HSSFRichTextString( "" ) );
		cell14.setCellStyle( headstyle );
		HSSFCell cell15 = row1.createCell( 15 );
		cell15.setCellValue( new HSSFRichTextString( "" ) );
		cell15.setCellStyle( headstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 1, num + 1, 0, 15 ) );//合并

		HSSFRow row2 = sheet.createRow( num + 2 );// 创建第二行无数据行

		// 创建第三行
		HSSFRow row3 = sheet.createRow( num + 3 );
		row3.setHeight( (short) 326 );// 设置行高
		// 创建列
		HSSFCell cell200 = row3.createCell( 0 );
		cell200.setCellValue( new HSSFRichTextString( "报销编号" ) );
		cell200.setCellStyle( centerstyle );
		HSSFCell cell201 = row3.createCell( 1 );
		cell201.setCellValue( new HSSFRichTextString( "" ) );
		cell201.setCellStyle( centerstyle );
		HSSFCell cell202 = row3.createCell( 2 );
		cell202.setCellValue( new HSSFRichTextString( bxvo.getBxbh() ) );
		cell202.setCellStyle( centerstyle );
		HSSFCell cell203 = row3.createCell( 3 );
		cell203.setCellValue( new HSSFRichTextString( "" ) );
		cell203.setCellStyle( centerstyle );
		HSSFCell cell204 = row3.createCell( 4 );
		cell204.setCellValue( new HSSFRichTextString( "" ) );
		cell204.setCellStyle( centerstyle );
		HSSFCell cell205 = row3.createCell( 5 );
		cell205.setCellValue( new HSSFRichTextString( "" ) );
		cell205.setCellStyle( centerstyle );
		HSSFCell cell206 = row3.createCell( 6 );
		cell206.setCellValue( new HSSFRichTextString( "" ) );
		cell206.setCellStyle( centerstyle );
		HSSFCell cell207 = row3.createCell( 7 );
		cell207.setCellValue( new HSSFRichTextString( "" ) );
		cell207.setCellStyle( centerstyle );
		HSSFCell cell208 = row3.createCell( 8 );
		cell208.setCellValue( new HSSFRichTextString( "报销日期" ) );
		cell208.setCellStyle( centerstyle );
		HSSFCell cell209 = row3.createCell( 9 );
		cell209.setCellValue( new HSSFRichTextString( "" ) );
		cell209.setCellStyle( centerstyle );
		HSSFCell cell210 = row3.createCell( 10 );
		cell210.setCellValue( new HSSFRichTextString( bxrq ) );
		cell210.setCellStyle( centerstyle );
		HSSFCell cell211 = row3.createCell( 11 );
		cell211.setCellValue( new HSSFRichTextString( "" ) );
		cell211.setCellStyle( centerstyle );
		HSSFCell cell212 = row3.createCell( 12 );
		cell212.setCellValue( new HSSFRichTextString( "" ) );
		cell212.setCellStyle( centerstyle );
		HSSFCell cell213 = row3.createCell( 13 );
		cell213.setCellValue( new HSSFRichTextString( "" ) );
		cell213.setCellStyle( centerstyle );
		HSSFCell cell214 = row3.createCell( 14 );
		cell214.setCellValue( new HSSFRichTextString( "" ) );
		cell214.setCellStyle( centerstyle );
		HSSFCell cell215 = row3.createCell( 15 );
		cell215.setCellValue( new HSSFRichTextString( "" ) );
		cell215.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 10, 15 ) );//合并
//		sheet.addMergedRegion(new CellRangeAddress(num+3, num+3, 2, 15));//合并
		num = num + 1;
		dexnum = dexnum + 1;

		//插入一行报销项目编号与项目名称
		HSSFRow row30 = sheet.createRow( num + 3 );
		row30.setHeight( (short) 326 );// 设置行高
		// 创建列
		HSSFCell cell2000 = row30.createCell( 0 );
		cell2000.setCellValue( new HSSFRichTextString( "出差事由" ) );
		cell2000.setCellStyle( centerstyle );
		HSSFCell cell2010 = row30.createCell( 1 );
		cell2010.setCellValue( new HSSFRichTextString( "" ) );
		cell2010.setCellStyle( centerstyle );
		HSSFCell cell2020 = row30.createCell( 2 );
		cell2020.setCellValue( new HSSFRichTextString( bxvo.getCcsyName() ) );
		cell2020.setCellStyle( centerstyle );
		HSSFCell cell2030 = row30.createCell( 3 );
		cell2030.setCellValue( new HSSFRichTextString( "" ) );
		cell2030.setCellStyle( centerstyle );
		HSSFCell cell2040 = row30.createCell( 4 );
		cell2040.setCellValue( new HSSFRichTextString( "" ) );
		cell2040.setCellStyle( centerstyle );
		HSSFCell cell2050 = row30.createCell( 5 );
		cell2050.setCellValue( new HSSFRichTextString( "" ) );
		cell2050.setCellStyle( centerstyle );
		HSSFCell cell2060 = row30.createCell( 6 );
		cell2060.setCellValue( new HSSFRichTextString( "" ) );
		cell2060.setCellStyle( centerstyle );
		HSSFCell cell2070 = row30.createCell( 7 );
		cell2070.setCellValue( new HSSFRichTextString( "" ) );
		cell2070.setCellStyle( centerstyle );
		HSSFCell cell2080 = row30.createCell( 8 );
		cell2080.setCellValue( new HSSFRichTextString( "票据张数" ) );
		cell2080.setCellStyle( centerstyle );
		HSSFCell cell2090 = row30.createCell( 9 );
		cell2090.setCellValue( new HSSFRichTextString( "" ) );
		cell2090.setCellStyle( centerstyle );
		HSSFCell cell2100 = row30.createCell( 10 );
		cell2100.setCellValue( new HSSFRichTextString( bxvo.getBillCount()+"张" ) );
		cell2100.setCellStyle( centerstyle );
		HSSFCell cell2110 = row30.createCell( 11 );
		cell2110.setCellValue( new HSSFRichTextString( "" ) );
		cell2110.setCellStyle( centerstyle );
		HSSFCell cell2120 = row30.createCell( 12 );
		cell2120.setCellValue( new HSSFRichTextString( "" ) );
		cell2120.setCellStyle( centerstyle );
		HSSFCell cell2130 = row30.createCell( 13 );
		cell2130.setCellValue( new HSSFRichTextString( "" ) );
		cell2130.setCellStyle( centerstyle );
		HSSFCell cell2140 = row30.createCell( 14 );
		cell2140.setCellValue( new HSSFRichTextString( "" ) );
		cell2140.setCellStyle( centerstyle );
		HSSFCell cell2150 = row30.createCell( 15 );
		cell2150.setCellValue( new HSSFRichTextString( "" ) );
		cell2150.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 10, 15 ) );//合并

//		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
//		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 15 ) );//合并

		// 创建第四行
		HSSFRow row4 = sheet.createRow( num + 4 ); // 设置行高
		row4.setHeight( (short) 326 ); // 创建列
		HSSFCell cell300 = row4.createCell( 0 );
		cell300.setCellValue( new HSSFRichTextString( "报销人" ) );
		cell300.setCellStyle( centerstyle );
		HSSFCell cell301 = row4.createCell( 1 );
		cell301.setCellValue( new HSSFRichTextString( "" ) );
		cell301.setCellStyle( centerstyle );
		HSSFCell cell302 = row4.createCell( 2 );
		cell302.setCellValue( new HSSFRichTextString( bxvo.getBxrName() ) );
		cell302.setCellStyle( centerstyle );
		HSSFCell cell303 = row4.createCell( 3 );
		cell303.setCellValue( new HSSFRichTextString( "" ) );
		cell303.setCellStyle( centerstyle );
		HSSFCell cell304 = row4.createCell( 4 );
		cell304.setCellValue( new HSSFRichTextString( "" ) );
		cell304.setCellStyle( centerstyle );
		HSSFCell cell305 = row4.createCell( 5 );
		cell305.setCellValue( new HSSFRichTextString( "" ) );
		cell305.setCellStyle( centerstyle );
		HSSFCell cell306 = row4.createCell( 6 );
		cell306.setCellValue( new HSSFRichTextString( "" ) );
		cell306.setCellStyle( centerstyle );
		HSSFCell cell307 = row4.createCell( 7 );
		cell307.setCellValue( new HSSFRichTextString( "" ) );
		cell307.setCellStyle( centerstyle );
		HSSFCell cell308 = row4.createCell( 8 );
		cell308.setCellValue( new HSSFRichTextString( "部门" ) );
		cell308.setCellStyle( centerstyle );
		HSSFCell cell309 = row4.createCell( 9 );
		cell309.setCellValue( new HSSFRichTextString( "" ) );
		cell309.setCellStyle( centerstyle );
		HSSFCell cell310 = row4.createCell( 10 );
		cell310.setCellValue( new HSSFRichTextString( bxvo.getBmidName() ) );
		cell310.setCellStyle( centerstyle );
		HSSFCell cell311 = row4.createCell( 11 );
		cell311.setCellValue( new HSSFRichTextString( "" ) );
		cell311.setCellStyle( centerstyle );
		HSSFCell cell312 = row4.createCell( 12 );
		cell312.setCellValue( new HSSFRichTextString( "" ) );
		cell312.setCellStyle( centerstyle );
		HSSFCell cell313 = row4.createCell( 13 );
		cell313.setCellValue( new HSSFRichTextString( "" ) );
		cell313.setCellStyle( centerstyle );
		HSSFCell cell314 = row4.createCell( 14 );
		cell314.setCellValue( new HSSFRichTextString( "" ) );
		cell314.setCellStyle( centerstyle );
		HSSFCell cell315 = row4.createCell( 15 );
		cell315.setCellValue( new HSSFRichTextString( "" ) );
		cell315.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 10, 15 ) );//合并
//		交通费头
		HSSFRow row5 = sheet.createRow( num + 5 ); // 设置行高
		row5.setHeight( (short) 326 ); // 创建列
		HSSFCell cell400 = row5.createCell( 0 );
		cell400.setCellValue( new HSSFRichTextString( "交通费" ) );
		cell400.setCellStyle( centerstyle );
		HSSFCell cell401 = row5.createCell( 1 );
		cell401.setCellValue( new HSSFRichTextString( "起讫日期" ) );
		cell401.setCellStyle( centerstyle );
		HSSFCell cell402 = row5.createCell( 2 );
		cell402.setCellValue( new HSSFRichTextString( "" ) );
		cell402.setCellStyle( centerstyle );
		HSSFCell cell403 = row5.createCell( 3 );
		cell403.setCellValue( new HSSFRichTextString( "" ) );
		cell403.setCellStyle( centerstyle );
		HSSFCell cell404 = row5.createCell( 4 );
		cell404.setCellValue( new HSSFRichTextString( "" ) );
		cell404.setCellStyle( centerstyle );
		HSSFCell cell405 = row5.createCell( 5 );
		cell405.setCellValue( new HSSFRichTextString( "起讫地点" ) );
		cell405.setCellStyle( centerstyle );
		HSSFCell cell406 = row5.createCell( 6 );
		cell406.setCellValue( new HSSFRichTextString( "" ) );
		cell406.setCellStyle( centerstyle );
		HSSFCell cell407 = row5.createCell( 7 );
		cell407.setCellValue( new HSSFRichTextString( "" ) );
		cell407.setCellStyle( centerstyle );
		HSSFCell cell408 = row5.createCell( 8 );
		cell408.setCellValue( new HSSFRichTextString( "车船机票" ) );
		cell408.setCellStyle( centerstyle );
		HSSFCell cell409 = row5.createCell( 9 );
		cell409.setCellValue( new HSSFRichTextString( "" ) );
		cell409.setCellStyle( centerstyle );
		HSSFCell cell410 = row5.createCell( 10 );
		cell410.setCellValue( new HSSFRichTextString( "" ) );
		cell410.setCellStyle( centerstyle );
		HSSFCell cell411 = row5.createCell( 11 );
		cell411.setCellValue( new HSSFRichTextString( "" ) );
		cell411.setCellStyle( centerstyle );
		HSSFCell cell412 = row5.createCell( 12 );
		cell412.setCellValue( new HSSFRichTextString( "" ) );
		cell412.setCellStyle( centerstyle );
		HSSFCell cell413 = row5.createCell( 13 );
		cell413.setCellValue( new HSSFRichTextString( "" ) );
		cell413.setCellStyle( centerstyle );
		HSSFCell cell414 = row5.createCell( 14 );
		cell414.setCellValue( new HSSFRichTextString( "小计（元）" ) );
		cell414.setCellStyle( centerstyle );
		HSSFCell cell415 = row5.createCell( 15 );
		cell415.setCellValue( new HSSFRichTextString( "" ) );
		cell415.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 5, 1, 4 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 6, 5, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 5, 8, 13 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 6, 14, 15 ) );//合并

		HSSFRow row6 = sheet.createRow( num + 6 ); // 设置行高
		row6.setHeight( (short) 326 ); // 创建列
		HSSFCell cell500 = row6.createCell( 0 );
		cell500.setCellValue( new HSSFRichTextString() );
		cell500.setCellStyle( centerstyle );
		HSSFCell cell501 = row6.createCell( 1 );
		cell501.setCellValue( new HSSFRichTextString( "月" ) );
		cell501.setCellStyle( centerstyle );
		HSSFCell cell502 = row6.createCell( 2 );
		cell502.setCellValue( new HSSFRichTextString( "" ) );
		cell502.setCellStyle( centerstyle );
		HSSFCell cell503 = row6.createCell( 3 );
		cell503.setCellValue( new HSSFRichTextString( "日" ) );
		cell503.setCellStyle( centerstyle );
		HSSFCell cell504 = row6.createCell( 4 );
		cell504.setCellValue( new HSSFRichTextString( "" ) );
		cell504.setCellStyle( centerstyle );
		HSSFCell cell505 = row6.createCell( 5 );
		cell505.setCellValue( new HSSFRichTextString( "" ) );
		cell505.setCellStyle( centerstyle );
		HSSFCell cell506 = row6.createCell( 6 );
		cell506.setCellValue( new HSSFRichTextString( "" ) );
		cell506.setCellStyle( centerstyle );
		HSSFCell cell507 = row6.createCell( 7 );
		cell507.setCellValue( new HSSFRichTextString( "" ) );
		cell507.setCellStyle( centerstyle );
		HSSFCell cell508 = row6.createCell( 8 );
		cell508.setCellValue( new HSSFRichTextString( "火车" ) );
		cell508.setCellStyle( centerstyle );
		HSSFCell cell509 = row6.createCell( 9 );
		cell509.setCellValue( new HSSFRichTextString( "" ) );
		cell509.setCellStyle( centerstyle );
		HSSFCell cell510 = row6.createCell( 10 );
		cell510.setCellValue( new HSSFRichTextString( "飞机" ) );
		cell510.setCellStyle( centerstyle );
		HSSFCell cell511 = row6.createCell( 11 );
		cell511.setCellValue( new HSSFRichTextString( "" ) );
		cell511.setCellStyle( centerstyle );
		HSSFCell cell512 = row6.createCell( 12 );
		cell512.setCellValue( new HSSFRichTextString( "汽车" ) );
		cell512.setCellStyle( centerstyle );
		HSSFCell cell513 = row6.createCell( 13 );
		cell513.setCellValue( new HSSFRichTextString( "" ) );
		cell513.setCellStyle( centerstyle );
		HSSFCell cell514 = row6.createCell( 14 );
		cell514.setCellValue( new HSSFRichTextString( "小计（元）" ) );
		cell514.setCellStyle( centerstyle );
		HSSFCell cell515 = row6.createCell( 15 );
		cell515.setCellValue( new HSSFRichTextString( "" ) );
		cell515.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 6, num + 6, 1, 2 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 6, num + 6, 3, 4 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 6, num + 6, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 6, num + 6, 10, 11 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 6, num + 6, 12, 13 ) );//合并
		//******************循环插值  7行开始******************************************************************
//		循环交通费
		Integer bxxcmxVOListsize = bxxcmxVOList.size();
		if (bxxcmxVOListsize > jtLength) {
			jtLength = bxxcmxVOListsize;
		}
		for (int i = 1; i <= jtLength; i++) {
			String qd = "";
			String zd = "";
			String hc = "";
			String fj = "";
			String jcdb = "";
			String jty1 = "";
			String jty2 = "";
			String jtr1 = "";
			String jtr2 = "";
			if (i <= bxxcmxVOListsize) {
				BxxcmxVO bxxcmxVO = bxxcmxVOList.get( i - 1 );
				String qzrq = bxxcmxVO.getKssj() == null ? "" : mmdd.format( bxxcmxVO.getKssj() );
				if (!qzrq.equals( "" )) {
					jty1 = qzrq.substring( 0, 1 );
					jty2 = qzrq.substring( 1, 2 );
					jtr1 = qzrq.substring( 3, 4 );
					jtr2 = qzrq.substring( 4, 5 );

				}
				qd = bxxcmxVO.getQd() + "-";
				zd = bxxcmxVO.getZd();
				//hc = bxxcmxVO.getHcje().stripTrailingZeros().toPlainString().equals( "0" ) ? "" : "¥" + bxxcmxVO.getHcje().stripTrailingZeros().toPlainString() + "";
				hc = bxxcmxVO.getHcje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "¥" + bxxcmxVO.getHcje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "";
				//fj = bxxcmxVO.getFjje().stripTrailingZeros().toPlainString().equals( "0" ) ? "" : "¥" + bxxcmxVO.getFjje().stripTrailingZeros().toPlainString() + "";
				fj = bxxcmxVO.getFjje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "¥" + bxxcmxVO.getFjje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "";
				//jcdb = bxxcmxVO.getJcdbje().stripTrailingZeros().toPlainString().equals( "0" ) ? "" : "¥" + bxxcmxVO.getJcdbje().stripTrailingZeros().toPlainString() + "";
				jcdb = bxxcmxVO.getJcdbje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "¥" + bxxcmxVO.getJcdbje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "";
			}
			Integer j = 6 + dexnum + i;
			HSSFRow row7 = sheet.createRow( j ); // 设置行高
			row7.setHeight( (short) 326 ); // 创建列
			HSSFCell cell600 = row7.createCell( 0 );
			cell600.setCellValue( new HSSFRichTextString( "" ) );
			cell600.setCellStyle( centerstyle );
			HSSFCell cell601 = row7.createCell( 1 );
			cell601.setCellValue( new HSSFRichTextString( jty1 ) );
			cell601.setCellStyle( centerstyle );
			HSSFCell cell602 = row7.createCell( 2 );
			cell602.setCellValue( new HSSFRichTextString( jty2 ) );
			cell602.setCellStyle( centerstyle );
			HSSFCell cell603 = row7.createCell( 3 );
			cell603.setCellValue( new HSSFRichTextString( jtr1 ) );
			cell603.setCellStyle( centerstyle );
			HSSFCell cell604 = row7.createCell( 4 );
			cell604.setCellValue( new HSSFRichTextString( jtr2 ) );
			cell604.setCellStyle( centerstyle );
			HSSFCell cell605 = row7.createCell( 5 );
			cell605.setCellValue( new HSSFRichTextString( qd + zd ) );
			cell605.setCellStyle( centerstyle );
			HSSFCell cell606 = row7.createCell( 6 );
			cell606.setCellValue( new HSSFRichTextString( "" ) );
			cell606.setCellStyle( centerstyle );
			HSSFCell cell607 = row7.createCell( 7 );
			cell607.setCellValue( new HSSFRichTextString( "" ) );
			cell607.setCellStyle( centerstyle );
			HSSFCell cell608 = row7.createCell( 8 );
			cell608.setCellValue( new HSSFRichTextString( hc ) );
			cell608.setCellStyle( rightstyle10 );
			HSSFCell cell609 = row7.createCell( 9 );
			cell609.setCellValue( new HSSFRichTextString() );
			cell609.setCellStyle( centerstyle );
			HSSFCell cell610 = row7.createCell( 10 );
			cell610.setCellValue( new HSSFRichTextString( fj ) );
			cell610.setCellStyle( rightstyle10 );
			HSSFCell cell611 = row7.createCell( 11 );
			cell611.setCellValue( new HSSFRichTextString( "" ) );
			cell611.setCellStyle( centerstyle );
			HSSFCell cell612 = row7.createCell( 12 );
			cell612.setCellValue( new HSSFRichTextString( jcdb ) );
			cell612.setCellStyle( rightstyle10 );
			HSSFCell cell613 = row7.createCell( 13 );
			cell613.setCellValue( new HSSFRichTextString( "" ) );
			cell613.setCellStyle( centerstyle );
			HSSFCell cell614 = row7.createCell( 14 );
			cell614.setCellValue( new HSSFRichTextString( bxvo.getJtfjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getJtfjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
			cell614.setCellStyle( rightstyle10 );
			HSSFCell cell615 = row7.createCell( 15 );
			cell615.setCellValue( new HSSFRichTextString( "" ) );
			cell615.setCellStyle( centerstyle );
			sheet.addMergedRegion( new CellRangeAddress( j, j, 5, 7 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 8, 9 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 10, 11 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 12, 13 ) );//合并
		}
		dexnum = dexnum + jtLength;//dexnum+交通的长度
		sheet.addMergedRegion( new CellRangeAddress( 5 + num, 6 + dexnum, 0, 0 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 7 + num, 6 + dexnum, 14, 15 ) );//合并
//		住宿头
		HSSFRow row8 = sheet.createRow( 7 + dexnum );
		row8.setHeight( (short) 326 );
		HSSFCell cell700 = row8.createCell( 0 );
		cell700.setCellValue( new HSSFRichTextString( "住宿费" ) );
		cell700.setCellStyle( centerstyle );
		HSSFCell cell701 = row8.createCell( 1 );
		cell701.setCellValue( new HSSFRichTextString( "地点" ) );
		cell701.setCellStyle( centerstyle );
		HSSFCell cell702 = row8.createCell( 2 );
		cell702.setCellValue( new HSSFRichTextString( "" ) );
		cell702.setCellStyle( centerstyle );
		HSSFCell cell703 = row8.createCell( 3 );
		cell703.setCellValue( new HSSFRichTextString( "" ) );
		cell703.setCellStyle( centerstyle );
		HSSFCell cell704 = row8.createCell( 4 );
		cell704.setCellValue( new HSSFRichTextString( "" ) );
		cell704.setCellStyle( centerstyle );
		HSSFCell cell705 = row8.createCell( 5 );
		cell705.setCellValue( new HSSFRichTextString( "" ) );
		cell705.setCellStyle( centerstyle );
		HSSFCell cell706 = row8.createCell( 6 );
		cell706.setCellValue( new HSSFRichTextString( "" ) );
		cell706.setCellStyle( centerstyle );
		HSSFCell cell707 = row8.createCell( 7 );
		cell707.setCellValue( new HSSFRichTextString( "" ) );
		cell707.setCellStyle( centerstyle );
		HSSFCell cell708 = row8.createCell( 8 );
		cell708.setCellValue( new HSSFRichTextString( "天数" ) );
		cell708.setCellStyle( centerstyle );
		HSSFCell cell709 = row8.createCell( 9 );
		cell709.setCellValue( new HSSFRichTextString( "" ) );
		cell709.setCellStyle( centerstyle );
		HSSFCell cell710 = row8.createCell( 10 );
		cell710.setCellValue( new HSSFRichTextString( "" ) );
		cell710.setCellStyle( centerstyle );
		HSSFCell cell711 = row8.createCell( 11 );
		cell711.setCellValue( new HSSFRichTextString( "金额" ) );
		cell711.setCellStyle( centerstyle );
		HSSFCell cell712 = row8.createCell( 12 );
		cell712.setCellValue( new HSSFRichTextString( "" ) );
		cell712.setCellStyle( centerstyle );
		HSSFCell cell713 = row8.createCell( 13 );
		cell713.setCellValue( new HSSFRichTextString( "" ) );
		cell713.setCellStyle( centerstyle );
		HSSFCell cell714 = row8.createCell( 14 );
		cell714.setCellValue( new HSSFRichTextString( bxvo.getZsfjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getZsfjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
		cell714.setCellStyle( rightstyle10 );
		HSSFCell cell715 = row8.createCell( 15 );
		cell715.setCellValue( new HSSFRichTextString( "" ) );
		cell715.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 7 + dexnum, 7 + dexnum, 1, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 7 + dexnum, 7 + dexnum, 8, 10 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 7 + dexnum, 7 + dexnum, 11, 13 ) );//合并
//循环住宿
		for (int m = 1; m <= zsLength; m++) {
			Integer j = 7 + dexnum + m;
			String zsdd = "";
			String zsts = "";
			String zsje = "";
			if (m <= bxxcmxVOListsize) {
				Integer aa = m - 1;
				BxxcmxVO bxxcmxVO = bxxcmxVOList.get( aa );
				if (!bxxcmxVO.getZsje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" )) {
					zsdd = bxxcmxVO.getZsdd();
					zsts = bxxcmxVO.getZsts() + "";
				} else {
					aa = aa + 1;
				}
				zsje = bxxcmxVO.getZsje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "¥" + bxxcmxVO.getZsje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "";
			}
			HSSFRow row9 = sheet.createRow( j ); // 设置行高
			row9.setHeight( (short) 326 );
			HSSFCell cell800 = row9.createCell( 0 );// 创建列
			cell800.setCellValue( new HSSFRichTextString( "" ) );
			cell800.setCellStyle( centerstyle );
			HSSFCell cell801 = row9.createCell( 1 );
			cell801.setCellValue( new HSSFRichTextString( zsdd ) );
			cell801.setCellStyle( centerstyle );
			HSSFCell cell802 = row9.createCell( 2 );
			cell802.setCellValue( new HSSFRichTextString( "" ) );
			cell802.setCellStyle( centerstyle );
			HSSFCell cell803 = row9.createCell( 3 );
			cell803.setCellValue( new HSSFRichTextString( "" ) );
			cell803.setCellStyle( centerstyle );
			HSSFCell cell804 = row9.createCell( 4 );
			cell804.setCellValue( new HSSFRichTextString( "" ) );
			cell804.setCellStyle( centerstyle );
			HSSFCell cell805 = row9.createCell( 5 );
			cell805.setCellValue( new HSSFRichTextString( "" ) );
			cell805.setCellStyle( centerstyle );
			HSSFCell cell806 = row9.createCell( 6 );
			cell806.setCellValue( new HSSFRichTextString( "" ) );
			cell806.setCellStyle( centerstyle );
			HSSFCell cell807 = row9.createCell( 7 );
			cell807.setCellValue( new HSSFRichTextString( "" ) );
			cell807.setCellStyle( centerstyle );
			HSSFCell cell808 = row9.createCell( 8 );
			cell808.setCellValue( new HSSFRichTextString( zsts ) );
			cell808.setCellStyle( centerstyle );
			HSSFCell cell809 = row9.createCell( 9 );
			cell809.setCellValue( new HSSFRichTextString( "" ) );
			cell809.setCellStyle( centerstyle );
			HSSFCell cell810 = row9.createCell( 10 );
			cell810.setCellValue( new HSSFRichTextString( "" ) );
			cell810.setCellStyle( centerstyle );
			HSSFCell cell811 = row9.createCell( 11 );
			cell811.setCellValue( new HSSFRichTextString( zsje ) );
			cell811.setCellStyle( rightstyle10 );
			HSSFCell cell812 = row9.createCell( 12 );
			cell812.setCellValue( new HSSFRichTextString( "" ) );
			cell812.setCellStyle( centerstyle );
			HSSFCell cell813 = row9.createCell( 13 );
			cell813.setCellValue( new HSSFRichTextString( "" ) );
			cell813.setCellStyle( centerstyle );
			HSSFCell cell814 = row9.createCell( 14 );
			cell814.setCellValue( new HSSFRichTextString( bxvo.getZsfjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥" + bxvo.getZsfjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "元" ) );
			cell814.setCellStyle( rightstyle10 );
			HSSFCell cell815 = row9.createCell( 15 );
			cell815.setCellValue( new HSSFRichTextString( "" ) );
			cell815.setCellStyle( centerstyle );
			sheet.addMergedRegion( new CellRangeAddress( j, j, 1, 7 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 8, 10 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 11, 13 ) );//合并
		}
		sheet.addMergedRegion( new CellRangeAddress( 7 + dexnum, 7 + dexnum + zsLength, 0, 0 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 7 + dexnum, 7 + dexnum + zsLength, 14, 15 ) );//合并
		dexnum = dexnum + zsLength;//加上住宿的长度
//		补贴头
		HSSFRow row10 = sheet.createRow( 8 + dexnum ); // 设置行高
		row10.setHeight( (short) 326 );
		HSSFCell cell900 = row10.createCell( 0 );// 创建列
		cell900.setCellValue( new HSSFRichTextString( "补贴" ) );
		cell900.setCellStyle( centerstyle );
		HSSFCell cell901 = row10.createCell( 1 );
		cell901.setCellValue( new HSSFRichTextString( "地点" ) );
		cell901.setCellStyle( centerstyle );
		HSSFCell cell902 = row10.createCell( 2 );
		cell902.setCellValue( new HSSFRichTextString( "" ) );
		cell902.setCellStyle( centerstyle );
		HSSFCell cell903 = row10.createCell( 3 );
		cell903.setCellValue( new HSSFRichTextString( "" ) );
		cell903.setCellStyle( centerstyle );
		HSSFCell cell904 = row10.createCell( 4 );
		cell904.setCellValue( new HSSFRichTextString( "" ) );
		cell904.setCellStyle( centerstyle );
		HSSFCell cell905 = row10.createCell( 5 );
		cell905.setCellValue( new HSSFRichTextString( "" ) );
		cell905.setCellStyle( centerstyle );
		HSSFCell cell906 = row10.createCell( 6 );
		cell906.setCellValue( new HSSFRichTextString( "" ) );
		cell906.setCellStyle( centerstyle );
		HSSFCell cell907 = row10.createCell( 7 );
		cell907.setCellValue( new HSSFRichTextString( "" ) );
		cell907.setCellStyle( centerstyle );
		HSSFCell cell908 = row10.createCell( 8 );
		cell908.setCellValue( new HSSFRichTextString( "天数" ) );
		cell908.setCellStyle( centerstyle );
		HSSFCell cell909 = row10.createCell( 9 );
		cell909.setCellValue( new HSSFRichTextString( "标准" ) );
		cell909.setCellStyle( centerstyle );
		HSSFCell cell910 = row10.createCell( 10 );
		cell910.setCellValue( new HSSFRichTextString( "" ) );
		cell910.setCellStyle( centerstyle );
		HSSFCell cell911 = row10.createCell( 11 );
		cell911.setCellValue( new HSSFRichTextString( "金额" ) );
		cell911.setCellStyle( centerstyle );
		HSSFCell cell912 = row10.createCell( 12 );
		cell912.setCellValue( new HSSFRichTextString( "" ) );
		cell912.setCellStyle( centerstyle );
		HSSFCell cell913 = row10.createCell( 13 );
		cell913.setCellValue( new HSSFRichTextString( "" ) );
		cell913.setCellStyle( centerstyle );
		HSSFCell cell914 = row10.createCell( 14 );
		cell914.setCellValue( new HSSFRichTextString( bxvo.getBtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getBtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
		cell914.setCellStyle( rightstyle10 );
		HSSFCell cell915 = row10.createCell( 15 );
		cell915.setCellValue( new HSSFRichTextString( "" ) );
		cell915.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 8 + dexnum, 8 + dexnum, 1, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 8 + dexnum, 8 + dexnum, 9, 10 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 8 + dexnum, 8 + dexnum, 11, 13 ) );//合并
//		循环补贴
		List btList = new ArrayList();
//		Set btSet = new HashSet();
		Map<String, List<BxxcmxVO>> drcodeMap = bxxcmxVOList.stream().collect( Collectors.groupingBy( b -> b.getBtbz().toString() ) );
		for (Map.Entry<String, List<BxxcmxVO>> entry : drcodeMap.entrySet()) {
			Map csMap = new HashMap();
			String btddd = entry.getValue().stream().map( aa -> aa.getBtdd() ).distinct().collect( Collectors.joining( "," ) );
			String bttss = entry.getValue().stream().mapToInt( l -> Integer.valueOf( l.getBtts() ) ).sum() + "";
			String btjee = entry.getValue().stream().mapToDouble( p -> p.getBtje().doubleValue() ).reduce( 0, Double::sum ) + "";
			String btbzz = entry.getKey();
			csMap.put( "btdd", btddd );
			csMap.put( "btts", bttss );
			csMap.put( "btje", btjee );
			csMap.put( "btbz", btbzz );
			btList.add( csMap );
		}

		for (int k = 1; k <= btLength; k++) {
			Integer j = 8 + dexnum + k;
			String btdd = "";
			String btts = "";
			String btbz = "";
			String btje = "";
			if (k <= btList.size()) {
				Bxxcmx bxxc = JSON.parseObject( JSON.toJSONString( btList.get( k - 1 ) ), Bxxcmx.class );
				btdd = bxxc.getBtdd();
				btbz = "¥" + bxxc.getBtbz().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "";
				btje = "¥" + bxxc.getBtje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "";
				btts = bxxc.getBtts() + "";
			}
			HSSFRow row11 = sheet.createRow( j ); // 设置行高
			row11.setHeight( (short) 326 );
			HSSFCell cell1000 = row11.createCell( 0 );// 创建列
			cell1000.setCellValue( new HSSFRichTextString( "" ) );
			cell1000.setCellStyle( centerstyle );
			HSSFCell cell1001 = row11.createCell( 1 );
			cell1001.setCellValue( new HSSFRichTextString( btdd ) );
			cell1001.setCellStyle( centerstyle );
			HSSFCell cell1002 = row11.createCell( 2 );
			cell1002.setCellValue( new HSSFRichTextString( "" ) );
			cell1002.setCellStyle( centerstyle );
			HSSFCell cell1003 = row11.createCell( 3 );
			cell1003.setCellValue( new HSSFRichTextString( "" ) );
			cell1003.setCellStyle( centerstyle );
			HSSFCell cell1004 = row11.createCell( 4 );
			cell1004.setCellValue( new HSSFRichTextString( "" ) );
			cell1004.setCellStyle( centerstyle );
			HSSFCell cell1005 = row11.createCell( 5 );
			cell1005.setCellValue( new HSSFRichTextString( "" ) );
			cell1005.setCellStyle( centerstyle );
			HSSFCell cell1006 = row11.createCell( 6 );
			cell1006.setCellValue( new HSSFRichTextString( "" ) );
			cell1006.setCellStyle( centerstyle );
			HSSFCell cell1007 = row11.createCell( 7 );
			cell1007.setCellValue( new HSSFRichTextString( "" ) );
			cell1007.setCellStyle( centerstyle );
			HSSFCell cell1008 = row11.createCell( 8 );
			cell1008.setCellValue( new HSSFRichTextString( btts ) );
			cell1008.setCellStyle( centerstyle );
			HSSFCell cell1009 = row11.createCell( 9 );
			cell1009.setCellValue( new HSSFRichTextString( btbz ) );
			cell1009.setCellStyle( rightstyle10 );
			HSSFCell cell1010 = row11.createCell( 10 );
			cell1010.setCellValue( new HSSFRichTextString( "" ) );
			cell1010.setCellStyle( centerstyle );
			HSSFCell cell1011 = row11.createCell( 11 );
			cell1011.setCellValue( new HSSFRichTextString( btje ) );
			cell1011.setCellStyle( rightstyle10 );
			HSSFCell cell1012 = row11.createCell( 12 );
			cell1012.setCellValue( new HSSFRichTextString( "" ) );
			cell1012.setCellStyle( centerstyle );
			HSSFCell cell1013 = row11.createCell( 13 );
			cell1013.setCellValue( new HSSFRichTextString( "" ) );
			cell1013.setCellStyle( centerstyle );
			HSSFCell cell1014 = row11.createCell( 14 );
			cell1014.setCellValue( new HSSFRichTextString( bxvo.getBtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getBtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
			cell1014.setCellStyle( rightstyle10 );
			HSSFCell cell1015 = row11.createCell( 15 );
			cell1015.setCellValue( new HSSFRichTextString( "" ) );
			cell1015.setCellStyle( centerstyle );
			sheet.addMergedRegion( new CellRangeAddress( j, j, 1, 7 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 9, 10 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 11, 13 ) );//合并
		}
		sheet.addMergedRegion( new CellRangeAddress( 8 + dexnum, 8 + dexnum + btLength, 0, 0 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 8 + dexnum, 8 + dexnum + btLength, 14, 15 ) );//合并
		dexnum = dexnum + btLength;//加上补贴的长度
//其他头
		HSSFRow row12 = sheet.createRow( 9 + dexnum ); // 设置行高
		row12.setHeight( (short) 326 );
		HSSFCell cell1100 = row12.createCell( 0 );// 创建列
		cell1100.setCellValue( new HSSFRichTextString( " 其他" ) );
		cell1100.setCellStyle( centerstyle );
		HSSFCell cell1001 = row12.createCell( 1 );
		cell1001.setCellValue( new HSSFRichTextString( "摘要" ) );
		cell1001.setCellStyle( centerstyle );
		HSSFCell cell1002 = row12.createCell( 2 );
		cell1002.setCellValue( new HSSFRichTextString( "" ) );
		cell1002.setCellStyle( centerstyle );
		HSSFCell cell1003 = row12.createCell( 3 );
		cell1003.setCellValue( new HSSFRichTextString( "" ) );
		cell1003.setCellStyle( centerstyle );
		HSSFCell cell1004 = row12.createCell( 4 );
		cell1004.setCellValue( new HSSFRichTextString( "" ) );
		cell1004.setCellStyle( centerstyle );
		HSSFCell cell1005 = row12.createCell( 5 );
		cell1005.setCellValue( new HSSFRichTextString( "" ) );
		cell1005.setCellStyle( centerstyle );
		HSSFCell cell1006 = row12.createCell( 6 );
		cell1006.setCellValue( new HSSFRichTextString( "" ) );
		cell1006.setCellStyle( centerstyle );
		HSSFCell cell1007 = row12.createCell( 7 );
		cell1007.setCellValue( new HSSFRichTextString( "" ) );
		cell1007.setCellStyle( centerstyle );
		HSSFCell cell1008 = row12.createCell( 8 );
		cell1008.setCellValue( new HSSFRichTextString( "金额" ) );
		cell1008.setCellStyle( centerstyle );
		HSSFCell cell1009 = row12.createCell( 9 );
		cell1009.setCellValue( new HSSFRichTextString( "" ) );
		cell1009.setCellStyle( centerstyle );
		HSSFCell cell1110 = row12.createCell( 10 );
		cell1110.setCellValue( new HSSFRichTextString( "" ) );
		cell1110.setCellStyle( centerstyle );
		HSSFCell cell1111 = row12.createCell( 11 );
		cell1111.setCellValue( new HSSFRichTextString( "" ) );
		cell1111.setCellStyle( centerstyle );
		HSSFCell cell1112 = row12.createCell( 12 );
		cell1112.setCellValue( new HSSFRichTextString( "" ) );
		cell1112.setCellStyle( centerstyle );
		HSSFCell cell1113 = row12.createCell( 13 );
		cell1113.setCellValue( new HSSFRichTextString( "" ) );
		cell1113.setCellStyle( centerstyle );
		HSSFCell cell1114 = row12.createCell( 14 );
		cell1114.setCellValue( new HSSFRichTextString( bxvo.getQtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getQtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
		cell1114.setCellStyle( rightstyle10 );
		HSSFCell cell1115 = row12.createCell( 15 );
		cell1115.setCellValue( new HSSFRichTextString( "" ) );
		cell1115.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 9 + dexnum, 9 + dexnum, 1, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 9 + dexnum, 9 + dexnum, 8, 13 ) );//合并
//		循环其他
		for (int o = 1; o <= qtLength; o++) {
			Integer j = 9 + dexnum + o;
			String qtzy = "";
			qtzy = bxxcmxVOList.stream().map( p -> p.getQtbz() ).collect( Collectors.joining( "," ) );
			String[] array = qtzy.split( "," );
			Set qtzyset = new HashSet();
			for (int i = 0; i < array.length; i++) {
				qtzyset.add( array[i] );
			}
			HSSFRow row13 = sheet.createRow( j ); // 设置行高
			row13.setHeight( (short) 326 );
			if (qtzyset.size() > 3) {
				row13.setHeight( (short) 700 );
			}
			HSSFCell cell1200 = row13.createCell( 0 );// 创建列
			cell1200.setCellValue( new HSSFRichTextString( "" ) );
			cell1200.setCellStyle( centerstyle );
			HSSFCell cell1201 = row13.createCell( 1 );
			cell1201.setCellValue( new HSSFRichTextString( qtzyset.toString().replace( "[", "" ).replace( "]", "" ) ) );
			cell1201.setCellStyle( centerstyle );
			HSSFCell cell1202 = row13.createCell( 2 );
			cell1202.setCellValue( new HSSFRichTextString( "" ) );
			cell1202.setCellStyle( centerstyle );
			HSSFCell cell1203 = row13.createCell( 3 );
			cell1203.setCellValue( new HSSFRichTextString( "" ) );
			cell1203.setCellStyle( centerstyle );
			HSSFCell cell1204 = row13.createCell( 4 );
			cell1204.setCellValue( new HSSFRichTextString( "" ) );
			cell1204.setCellStyle( centerstyle );
			HSSFCell cell1205 = row13.createCell( 5 );
			cell1205.setCellValue( new HSSFRichTextString( "" ) );
			cell1205.setCellStyle( centerstyle );
			HSSFCell cell1206 = row13.createCell( 6 );
			cell1206.setCellValue( new HSSFRichTextString( "" ) );
			cell1206.setCellStyle( centerstyle );
			HSSFCell cell1207 = row13.createCell( 7 );
			cell1207.setCellValue( new HSSFRichTextString( "" ) );
			cell1207.setCellStyle( centerstyle );
			HSSFCell cell1208 = row13.createCell( 8 );
			cell1208.setCellValue( new HSSFRichTextString( bxvo.getQtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "¥" + bxvo.getQtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
			cell1208.setCellStyle( rightstyle10 );
			HSSFCell cell1209 = row13.createCell( 9 );
			cell1209.setCellValue( new HSSFRichTextString( "" ) );
			cell1209.setCellStyle( centerstyle );
			HSSFCell cell1210 = row13.createCell( 10 );
			cell1210.setCellValue( new HSSFRichTextString( "" ) );
			cell1210.setCellStyle( centerstyle );
			HSSFCell cell1211 = row13.createCell( 11 );
			cell1211.setCellValue( new HSSFRichTextString( "" ) );
			cell1211.setCellStyle( centerstyle );
			HSSFCell cell1212 = row13.createCell( 12 );
			cell1212.setCellValue( new HSSFRichTextString( "" ) );
			cell1212.setCellStyle( centerstyle );
			HSSFCell cell1213 = row13.createCell( 13 );
			cell1213.setCellValue( new HSSFRichTextString( "" ) );
			cell1213.setCellStyle( centerstyle );
			HSSFCell cell1214 = row13.createCell( 14 );
			cell1214.setCellValue( new HSSFRichTextString( bxvo.getQtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "¥" + bxvo.getQtjexj().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() ) );
			cell1214.setCellStyle( rightstyle10 );
			HSSFCell cell1215 = row13.createCell( 15 );
			cell1215.setCellValue( new HSSFRichTextString( "" ) );
			cell1215.setCellStyle( centerstyle );
			sheet.addMergedRegion( new CellRangeAddress( j, j, 1, 7 ) );//合并
			sheet.addMergedRegion( new CellRangeAddress( j, j, 8, 13 ) );//合并
		}
		sheet.addMergedRegion( new CellRangeAddress( 9 + dexnum, 9 + dexnum + qtLength, 0, 0 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 9 + dexnum, 9 + dexnum + qtLength, 14, 15 ) );//合并
		dexnum = dexnum + qtLength;//加上其他的长度
//		报销金额大写
		HSSFRow row14 = sheet.createRow( 10 + dexnum ); // 设置行高
		row14.setHeight( (short) 326 );
		HSSFCell cell1330 = row14.createCell( 0 );// 创建列
		cell1330.setCellValue( new HSSFRichTextString( "报销金额" ) );
		cell1330.setCellStyle( centerstyle );
		HSSFCell cell1301 = row14.createCell( 1 );
		cell1301.setCellValue( new HSSFRichTextString( "   大写 合计人民币  " + bxvo.getBxzjedx() ) );
		cell1301.setCellStyle( leftstyle10 );
		HSSFCell cell1302 = row14.createCell( 2 );
		cell1302.setCellValue( new HSSFRichTextString( "" ) );
		cell1302.setCellStyle( centerstyle );
		HSSFCell cell1303 = row14.createCell( 3 );
		cell1303.setCellValue( new HSSFRichTextString( "" ) );
		cell1303.setCellStyle( centerstyle );
		HSSFCell cell1304 = row14.createCell( 4 );
		cell1304.setCellValue( new HSSFRichTextString( "" ) );
		cell1304.setCellStyle( centerstyle );
		HSSFCell cell1305 = row14.createCell( 5 );
		cell1305.setCellValue( new HSSFRichTextString( "" ) );
		cell1305.setCellStyle( centerstyle );
		HSSFCell cell1306 = row14.createCell( 6 );
		cell1306.setCellValue( new HSSFRichTextString( "" ) );
		cell1306.setCellStyle( centerstyle );
		HSSFCell cell1307 = row14.createCell( 7 );
		cell1307.setCellValue( new HSSFRichTextString( "" ) );
		cell1307.setCellStyle( centerstyle );
		HSSFCell cell1308 = row14.createCell( 8 );
		cell1308.setCellValue( new HSSFRichTextString( "" ) );
		cell1308.setCellStyle( centerstyle );
		HSSFCell cell1309 = row14.createCell( 9 );
		cell1309.setCellValue( new HSSFRichTextString("") );
		cell1309.setCellStyle( centerstyle );
		HSSFCell cell1310 = row14.createCell( 10 );
		cell1310.setCellValue( new HSSFRichTextString("") );
		cell1310.setCellStyle( centerstyle );
		HSSFCell cell1311 = row14.createCell( 11 );
		cell1311.setCellValue( new HSSFRichTextString( "9%进税" ) );
		cell1311.setCellStyle( centerstyle );
		HSSFCell cell1312 = row14.createCell( 12 );
		cell1312.setCellValue( new HSSFRichTextString("") );
		cell1312.setCellStyle( centerstyle );
		HSSFCell cell1313 = row14.createCell( 13 );
		cell1313.setCellValue( new HSSFRichTextString( "" ) );
		cell1313.setCellStyle( centerstyle );
		HSSFCell cell1314 = row14.createCell( 14 );
		cell1314.setCellValue( new HSSFRichTextString(bxvo.getDeductibleTax().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getDeductibleTax().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString()) );
		cell1314.setCellStyle( rightstyle10 );
		HSSFCell cell1315 = row14.createCell( 15 );
		cell1315.setCellValue( new HSSFRichTextString( "" ) );
		cell1315.setCellStyle( centerstyle );
//报销金额小写
		HSSFRow row15 = sheet.createRow( 11 + dexnum ); // 设置行高
		row15.setHeight( (short) 326 );
		HSSFCell cell1430 = row15.createCell( 0 );// 创建列
		cell1430.setCellValue( new HSSFRichTextString( "  " ) );
		cell1430.setCellStyle( centerstyle );
		HSSFCell cell1401 = row15.createCell( 1 );
		cell1401.setCellValue( new HSSFRichTextString( "   小写 " + "合计￥:      " + bxvo.getBxzje().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString() + "  元" ) );
		cell1401.setCellStyle( leftstyle10 );
		HSSFCell cell1402 = row15.createCell( 2 );
		cell1402.setCellValue( new HSSFRichTextString( "" ) );
		cell1402.setCellStyle( centerstyle );
		HSSFCell cell1403 = row15.createCell( 3 );
		cell1403.setCellValue( new HSSFRichTextString( "" ) );
		cell1403.setCellStyle( centerstyle );
		HSSFCell cell1404 = row15.createCell( 4 );
		cell1404.setCellValue( new HSSFRichTextString( "" ) );
		cell1404.setCellStyle( centerstyle );
		HSSFCell cell1405 = row15.createCell( 5 );
		cell1405.setCellValue( new HSSFRichTextString( "" ) );
		cell1405.setCellStyle( centerstyle );
		HSSFCell cell1406 = row15.createCell( 6 );
		cell1406.setCellValue( new HSSFRichTextString( "" ) );
		cell1406.setCellStyle( centerstyle );
		HSSFCell cell1407 = row15.createCell( 7 );
		cell1407.setCellValue( new HSSFRichTextString( "" ) );
		cell1407.setCellStyle( centerstyle );
		HSSFCell cell1408 = row15.createCell( 8 );
		cell1408.setCellValue( new HSSFRichTextString( "" ) );
		cell1408.setCellStyle( centerstyle );
		HSSFCell cell1409 = row15.createCell( 9 );
		cell1409.setCellValue( new HSSFRichTextString("") );
		cell1409.setCellStyle( centerstyle );
		HSSFCell cell1410 = row15.createCell( 10 );
		cell1410.setCellValue( new HSSFRichTextString("") );
		cell1410.setCellStyle( centerstyle );
		HSSFCell cell1411 = row15.createCell( 11 );
		cell1411.setCellValue( new HSSFRichTextString( "9%未税" ) );
		cell1411.setCellStyle( centerstyle );
		HSSFCell cell1412 = row15.createCell( 12 );
		cell1412.setCellValue( new HSSFRichTextString("") );
		cell1412.setCellStyle( centerstyle );
		HSSFCell cell1413 = row15.createCell( 13 );
		cell1413.setCellValue( new HSSFRichTextString( "" ) );
		cell1413.setCellStyle( centerstyle );
		HSSFCell cell1414 = row15.createCell( 14 );
		cell1414.setCellValue( new HSSFRichTextString( bxvo.getUntaxPrice().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString().equals( "0.00" ) ? "" : "  ¥:" + bxvo.getUntaxPrice().setScale( 2, BigDecimal.ROUND_HALF_UP ).toPlainString()) );
		cell1414.setCellStyle( rightstyle10 );
		HSSFCell cell1415 = row15.createCell( 15 );
		cell1415.setCellValue( new HSSFRichTextString( "" ) );
		cell1415.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 10 + dexnum, 11 + dexnum, 0, 0 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 10 + dexnum, 10 + dexnum, 1,10 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 10 + dexnum, 10 + dexnum, 11, 13 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 10 + dexnum, 10 + dexnum, 14, 15 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 11 + dexnum, 11 + dexnum, 1,10 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 11 + dexnum, 11 + dexnum, 11, 13) );//合并
		sheet.addMergedRegion( new CellRangeAddress( 11 + dexnum, 11 + dexnum, 14, 15 ) );//合并
//		sheet.addMergedRegion( new CellRangeAddress( 10 + dexnum, 10 + dexnum, 1, 15 ) );//合并
//		sheet.addMergedRegion( new CellRangeAddress( 11 + dexnum, 11 + dexnum, 1, 15 ) );//合并

//		表尾 批准人
		HSSFRow row16 = sheet.createRow( 12 + dexnum ); // 设置行高
		row16.setHeight( (short) 326 );
		HSSFCell cell1530 = row16.createCell( 0 );// 创建列
		cell1530.setCellValue( new HSSFRichTextString( "批准人:" + bxvo.getPzrqm() + "             " + "出纳:" + "             " + "复核人:" + bxvo.getFhrqm() + "             " + "审核人:" + bxvo.getShrqm() + "             " + "报销人:" + bxvo.getBxrqm() + "             " ) );
		cell1530.setCellStyle( leftstyle10 );
		HSSFCell cell1501 = row16.createCell( 1 );
		cell1501.setCellValue( new HSSFRichTextString( "" ) );
		cell1501.setCellStyle( centerstyle );
		HSSFCell cell1502 = row16.createCell( 2 );
		cell1502.setCellValue( new HSSFRichTextString( "" ) );
		cell1502.setCellStyle( centerstyle );
		HSSFCell cell1503 = row16.createCell( 3 );
		cell1503.setCellValue( new HSSFRichTextString( "" ) );
		cell1503.setCellStyle( centerstyle );
		HSSFCell cell1504 = row16.createCell( 4 );
		cell1504.setCellValue( new HSSFRichTextString( "" ) );
		cell1504.setCellStyle( centerstyle );
		HSSFCell cell1505 = row16.createCell( 5 );
		cell1505.setCellValue( new HSSFRichTextString( "" ) );
		cell1505.setCellStyle( centerstyle );
		HSSFCell cell1506 = row16.createCell( 6 );
		cell1506.setCellValue( new HSSFRichTextString( "" ) );
		cell1506.setCellStyle( centerstyle );
		HSSFCell cell1507 = row16.createCell( 7 );
		cell1507.setCellValue( new HSSFRichTextString( "" ) );
		cell1507.setCellStyle( centerstyle );
		HSSFCell cell1508 = row16.createCell( 8 );
		cell1508.setCellValue( new HSSFRichTextString( "" ) );
		cell1508.setCellStyle( centerstyle );
		HSSFCell cell1509 = row16.createCell( 9 );
		cell1509.setCellValue( new HSSFRichTextString( "" ) );
		cell1509.setCellStyle( centerstyle );
		HSSFCell cell1510 = row16.createCell( 10 );
		cell1510.setCellValue( new HSSFRichTextString( "" ) );
		cell1510.setCellStyle( centerstyle );
		HSSFCell cell1511 = row16.createCell( 11 );
		cell1511.setCellValue( new HSSFRichTextString( "" ) );
		cell1511.setCellStyle( centerstyle );
		HSSFCell cell1512 = row16.createCell( 12 );
		cell1512.setCellValue( new HSSFRichTextString( "" ) );
		cell1512.setCellStyle( centerstyle );
		HSSFCell cell1513 = row16.createCell( 13 );
		cell1513.setCellValue( new HSSFRichTextString( "" ) );
		cell1513.setCellStyle( centerstyle );
		HSSFCell cell1514 = row16.createCell( 14 );
		cell1514.setCellValue( new HSSFRichTextString( "" ) );
		cell1514.setCellStyle( centerstyle );
		HSSFCell cell1515 = row16.createCell( 15 );
		cell1515.setCellValue( new HSSFRichTextString( "" ) );
		cell1515.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 12 + dexnum, 12 + dexnum, 0, 15 ) );//合并
		return 12 + dexnum;
	}

	/**
	 * 新增费用报销单
	 *
	 * @param num         起始行数
	 * @param sheet
	 * @param headstyle
	 * @param centerstyle
	 */
	private Integer addfybxd(BxVo bxvo, List<BxfymxVO> bxfymxVOList, Integer num, Integer fyLength, HSSFSheet sheet, HSSFCellStyle headstyle, HSSFCellStyle centerstyle, HSSFCellStyle leftstyle, HSSFCellStyle columnHeadStyle, Integer fplx, HSSFCellStyle leftstyle10, Integer bs) {
		SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
		SimpleDateFormat yymmdd = new SimpleDateFormat( "yyyy-MM-dd" );
		SimpleDateFormat mmdd = new SimpleDateFormat( "MM月dd日" );
		//创建第一行表头
		//**********************头部***************************************************************
		String xmbh = bxfymxVOList.stream().map( p -> p.getXmbh() ).distinct().collect( Collectors.joining( "," ) );
		String xmmc = bxfymxVOList.stream().map( p -> p.getXmbhAbbName()== null ? "": p.getXmbhAbbName() ).distinct().collect( Collectors.joining( "," ) );
		HSSFRow row0 = sheet.createRow( num + 0 );// 创建第一行无数据行
		//row0.setHeight((short) 600);// 设置行高
		if (num > 1 && num % 2 == 0) {
			row0.setHeight( (short) 1478 );// 设置行高
		} else {
			row0.setHeight( (short) 526 );// 设置行高
		}
		HSSFRow row1 = sheet.createRow( num + 1 );// 创建第一行
		row1.setHeight( (short) 650 );// 设置行高
		HSSFCell cell0 = row1.createCell( 0 );
		cell0.setCellValue( new HSSFRichTextString( "费用报销单" ) );
		cell0.setCellStyle( headstyle );
		HSSFCell cell01 = row1.createCell( 1 );
		cell01.setCellValue( new HSSFRichTextString( "" ) );
		cell01.setCellStyle( headstyle );
		HSSFCell cell02 = row1.createCell( 2 );
		cell02.setCellValue( new HSSFRichTextString( "" ) );
		cell02.setCellStyle( headstyle );
		HSSFCell cell03 = row1.createCell( 3 );
		cell03.setCellValue( new HSSFRichTextString( "" ) );
		cell03.setCellStyle( headstyle );
		HSSFCell cell04 = row1.createCell( 4 );
		cell04.setCellValue( new HSSFRichTextString( "" ) );
		cell04.setCellStyle( headstyle );
		HSSFCell cell05 = row1.createCell( 5 );
		cell05.setCellValue( new HSSFRichTextString( "" ) );
		cell05.setCellStyle( headstyle );
		HSSFCell cell06 = row1.createCell( 6 );
		cell06.setCellValue( new HSSFRichTextString( "" ) );
		cell06.setCellStyle( headstyle );
		HSSFCell cell07 = row1.createCell( 7 );
		cell07.setCellValue( new HSSFRichTextString( "" ) );
		cell07.setCellStyle( headstyle );
		HSSFCell cell08 = row1.createCell( 8 );
		cell08.setCellValue( new HSSFRichTextString( "" ) );
		cell08.setCellStyle( headstyle );
		HSSFCell cell09 = row1.createCell( 9 );
		cell09.setCellValue( new HSSFRichTextString( "" ) );
		cell09.setCellStyle( headstyle );
		HSSFCell cell10 = row1.createCell( 10 );
		cell10.setCellValue( new HSSFRichTextString( "" ) );
		cell10.setCellStyle( headstyle );
		HSSFCell cell11 = row1.createCell( 11 );
		cell11.setCellValue( new HSSFRichTextString( "" ) );
		cell11.setCellStyle( headstyle );
		HSSFCell cell12 = row1.createCell( 12 );
		cell12.setCellValue( new HSSFRichTextString( "" ) );
		cell12.setCellStyle( headstyle );
		HSSFCell cell13 = row1.createCell( 13 );
		cell13.setCellValue( new HSSFRichTextString( "" ) );
		cell13.setCellStyle( headstyle );
		HSSFCell cell14 = row1.createCell( 14 );
		cell14.setCellValue( new HSSFRichTextString( "" ) );
		cell14.setCellStyle( headstyle );
		HSSFCell cell15 = row1.createCell( 15 );
		cell15.setCellValue( new HSSFRichTextString( "" ) );
		cell15.setCellStyle( headstyle );
		/**
		 * 合并单元格
		 *    第一个参数：第一个单元格的行数（从0开始）
		 *    第二个参数：第二个单元格的行数（从0开始）
		 *    第三个参数：第一个单元格的列数（从0开始）
		 *    第四个参数：第二个单元格的列数（从0开始）
		 */
		String bxbh = bxvo.getBxbh();
		String bxr = bxvo.getBxrName();
		String bmmc = bxvo.getBmidName();
		String bxrq = bxvo.getBxrq() == null ? "" : yymmdd.format( bxvo.getBxrq() );
		sheet.addMergedRegion( new CellRangeAddress( num + 1, num + 1, 0, 15 ) );//合并
		if (fplx == 0) {
			HSSFRow row2 = sheet.createRow( num + 2 );// 创建第二行无数据行
			HSSFCell cellx = row2.createCell( 15 );
			cellx.setCellValue( new HSSFRichTextString( "无票" ) );
			cellx.setCellStyle( centerstyle );
		}
		// 创建第三行
		HSSFRow row3 = sheet.createRow( num + 3 );
		row3.setHeight( (short) 600 );// 设置行高
		// 创建列
		HSSFCell cell200 = row3.createCell( 0 );
		cell200.setCellValue( new HSSFRichTextString( "报销编号" ) );
		cell200.setCellStyle( centerstyle );
		HSSFCell cell201 = row3.createCell( 1 );
		cell201.setCellValue( new HSSFRichTextString( "" ) );
		cell201.setCellStyle( centerstyle );
		HSSFCell cell202 = row3.createCell( 2 );
		cell202.setCellValue( new HSSFRichTextString( bxbh ) );
		cell202.setCellStyle( centerstyle );
		HSSFCell cell203 = row3.createCell( 3 );
		cell203.setCellValue( new HSSFRichTextString( "" ) );
		cell203.setCellStyle( centerstyle );
		HSSFCell cell204 = row3.createCell( 4 );
		cell204.setCellValue( new HSSFRichTextString( "" ) );
		cell204.setCellStyle( centerstyle );
		HSSFCell cell205 = row3.createCell( 5 );
		cell205.setCellValue( new HSSFRichTextString( "" ) );
		cell205.setCellStyle( centerstyle );
		HSSFCell cell206 = row3.createCell( 6 );
		cell206.setCellValue( new HSSFRichTextString( "" ) );
		cell206.setCellStyle( centerstyle );
		HSSFCell cell207 = row3.createCell( 7 );
		cell207.setCellValue( new HSSFRichTextString( "" ) );
		cell207.setCellStyle( centerstyle );
		HSSFCell cell208 = row3.createCell( 8 );
		cell208.setCellValue( new HSSFRichTextString( "部门" ) );
//		cell208.setCellValue(new HSSFRichTextString("项目编号"));
		cell208.setCellStyle( centerstyle );
		HSSFCell cell209 = row3.createCell( 9 );
		cell209.setCellValue( new HSSFRichTextString( "" ) );
		cell209.setCellStyle( centerstyle );
		HSSFCell cell210 = row3.createCell( 10 );
//		cell210.setCellValue(new HSSFRichTextString(xmbh));
		cell210.setCellValue( new HSSFRichTextString( bxvo.getBmidName() ) );//部门名称
		cell210.setCellStyle( centerstyle );
		HSSFCell cell211 = row3.createCell( 11 );
		cell211.setCellValue( new HSSFRichTextString( "" ) );
		cell211.setCellStyle( centerstyle );
		HSSFCell cell212 = row3.createCell( 12 );
		cell212.setCellValue( new HSSFRichTextString( "" ) );
		cell212.setCellStyle( centerstyle );
		HSSFCell cell213 = row3.createCell( 13 );
		cell213.setCellValue( new HSSFRichTextString( "" ) );
		cell213.setCellStyle( centerstyle );
		HSSFCell cell214 = row3.createCell( 14 );
		cell214.setCellValue( new HSSFRichTextString( "" ) );
		cell214.setCellStyle( centerstyle );
		HSSFCell cell215 = row3.createCell( 15 );
		cell215.setCellValue( new HSSFRichTextString( "" ) );
		cell215.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 10, 15 ) );//合并
//		sheet.addMergedRegion(new CellRangeAddress(num+3, num+3, 2, 15));//合并


		num = num + 1;
		//插入一行报销项目编号与项目名称
		HSSFRow row30 = sheet.createRow( num + 3 );
		row30.setHeight( (short) 600 );// 设置行高
		// 创建列
		HSSFCell cell2000 = row30.createCell( 0 );
		cell2000.setCellValue( new HSSFRichTextString( "报销人" ) );
		cell2000.setCellStyle( centerstyle );
		HSSFCell cell2010 = row30.createCell( 1 );
		cell2010.setCellValue( new HSSFRichTextString( "" ) );
		cell2010.setCellStyle( centerstyle );
		HSSFCell cell2020 = row30.createCell( 2 );
		cell2020.setCellValue( new HSSFRichTextString( bxr) );
		cell2020.setCellStyle( centerstyle );
		HSSFCell cell2030 = row30.createCell( 3 );
		cell2030.setCellValue( new HSSFRichTextString( "" ) );
		cell2030.setCellStyle( centerstyle );
		HSSFCell cell2040 = row30.createCell( 4 );
		cell2040.setCellValue( new HSSFRichTextString( "" ) );
		cell2040.setCellStyle( centerstyle );
		HSSFCell cell2050 = row30.createCell( 5 );
		cell2050.setCellValue( new HSSFRichTextString( "" ) );
		cell2050.setCellStyle( centerstyle );
		HSSFCell cell2060 = row30.createCell( 6 );
		cell2060.setCellValue( new HSSFRichTextString( "" ) );
		cell2060.setCellStyle( centerstyle );
		HSSFCell cell2070 = row30.createCell( 7 );
		cell2070.setCellValue( new HSSFRichTextString( "" ) );
		cell2070.setCellStyle( centerstyle );
		HSSFCell cell2080 = row30.createCell( 8 );
		cell2080.setCellValue( new HSSFRichTextString( "报销日期" ) );
		cell2080.setCellStyle( centerstyle );
		HSSFCell cell2090 = row30.createCell( 9 );
		cell2090.setCellValue( new HSSFRichTextString( "" ) );
		cell2090.setCellStyle( centerstyle );
		HSSFCell cell2100 = row30.createCell( 10 );
		cell2100.setCellValue( new HSSFRichTextString( bxrq ) );
		cell2100.setCellStyle( centerstyle );
		HSSFCell cell2110 = row30.createCell( 11 );
		cell2110.setCellValue( new HSSFRichTextString( "" ) );
		cell2110.setCellStyle( centerstyle );
		HSSFCell cell2120 = row30.createCell( 12 );
		cell2120.setCellValue( new HSSFRichTextString( "" ) );
		cell2120.setCellStyle( centerstyle );
		HSSFCell cell2130 = row30.createCell( 13 );
		cell2130.setCellValue( new HSSFRichTextString( "" ) );
		cell2130.setCellStyle( centerstyle );
		HSSFCell cell2140 = row30.createCell( 14 );
		cell2140.setCellValue( new HSSFRichTextString( "" ) );
		cell2140.setCellStyle( centerstyle );
		HSSFCell cell2150 = row30.createCell( 15 );
		cell2150.setCellValue( new HSSFRichTextString( "" ) );
		cell2150.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 10, 15 ) );//合并

		// 创建第四行
		HSSFRow row4 = sheet.createRow( num + 4 ); // 设置行高
		row4.setHeight( (short) 600 ); // 创建列
		HSSFCell cell300 = row4.createCell( 0 );
		cell300.setCellValue( new HSSFRichTextString( "票据张数" ) );
		cell300.setCellStyle( centerstyle );
		HSSFCell cell301 = row4.createCell( 1 );
		cell301.setCellValue( new HSSFRichTextString( "" ) );
		cell301.setCellStyle( centerstyle );
		HSSFCell cell302 = row4.createCell( 2 );
		cell302.setCellValue( new HSSFRichTextString( bxvo.getBillCount()+"张"  ) );
		cell302.setCellStyle( centerstyle );
		HSSFCell cell303 = row4.createCell( 3 );
		cell303.setCellValue( new HSSFRichTextString( "" ) );
		cell303.setCellStyle( centerstyle );
		HSSFCell cell304 = row4.createCell( 4 );
		cell304.setCellValue( new HSSFRichTextString( "" ) );
		cell304.setCellStyle( centerstyle );
		HSSFCell cell305 = row4.createCell( 5 );
		cell305.setCellValue( new HSSFRichTextString( "" ) );
		cell305.setCellStyle( centerstyle );
		HSSFCell cell306 = row4.createCell( 6 );
		cell306.setCellValue( new HSSFRichTextString( "" ) );
		cell306.setCellStyle( centerstyle );
		HSSFCell cell307 = row4.createCell( 7 );
		cell307.setCellValue( new HSSFRichTextString( "" ) );
		cell307.setCellStyle( centerstyle );
		HSSFCell cell308 = row4.createCell( 8 );
		cell308.setCellValue( new HSSFRichTextString( "" ) );
		cell308.setCellStyle( centerstyle );
		HSSFCell cell309 = row4.createCell( 9 );
		cell309.setCellValue( new HSSFRichTextString( "" ) );
		cell309.setCellStyle( centerstyle );
		HSSFCell cell310 = row4.createCell( 10 );
		cell310.setCellValue( new HSSFRichTextString( "" ) );
		cell310.setCellStyle( centerstyle );
		HSSFCell cell311 = row4.createCell( 11 );
		cell311.setCellValue( new HSSFRichTextString( "" ) );
		cell311.setCellStyle( centerstyle );
		HSSFCell cell312 = row4.createCell( 12 );
		cell312.setCellValue( new HSSFRichTextString( "" ) );
		cell312.setCellStyle( centerstyle );
		HSSFCell cell313 = row4.createCell( 13 );
		cell313.setCellValue( new HSSFRichTextString( "" ) );
		cell313.setCellStyle( centerstyle );
		HSSFCell cell314 = row4.createCell( 14 );
		cell314.setCellValue( new HSSFRichTextString( "" ) );
		cell314.setCellStyle( centerstyle );
		HSSFCell cell315 = row4.createCell( 15 );
		cell315.setCellValue( new HSSFRichTextString( "" ) );
		cell315.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 8, 15 ) );//合并
//		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 10, 15 ) );//合并
		// 创建第五行
		HSSFRow row5 = sheet.createRow( num + 5 ); // 设置行高
		row5.setHeight( (short) 600 ); // 创建列
		HSSFCell cell400 = row5.createCell( 0 );
		cell400.setCellValue( new HSSFRichTextString( "摘要" ) );
		cell400.setCellStyle( columnHeadStyle );
		HSSFCell cell401 = row5.createCell( 1 );
		cell401.setCellValue( new HSSFRichTextString( "" ) );
		cell401.setCellStyle( centerstyle );
		HSSFCell cell402 = row5.createCell( 2 );
		cell402.setCellValue( new HSSFRichTextString( "" ) );
		cell402.setCellStyle( centerstyle );
		HSSFCell cell403 = row5.createCell( 3 );
		cell403.setCellValue( new HSSFRichTextString( "" ) );
		cell403.setCellStyle( centerstyle );
		HSSFCell cell404 = row5.createCell( 4 );
		cell404.setCellValue( new HSSFRichTextString( "" ) );
		cell404.setCellStyle( centerstyle );
		HSSFCell cell405 = row5.createCell( 5 );
		cell405.setCellValue( new HSSFRichTextString( "" ) );
		cell405.setCellStyle( centerstyle );
		HSSFCell cell406 = row5.createCell( 6 );
		cell406.setCellValue( new HSSFRichTextString( "" ) );
		cell406.setCellStyle( centerstyle );
		HSSFCell cell407 = row5.createCell( 7 );
		cell407.setCellValue( new HSSFRichTextString( "" ) );
		cell407.setCellStyle( centerstyle );
		HSSFCell cell408 = row5.createCell( 8 );
		cell408.setCellValue( new HSSFRichTextString( "金额" ) );
		cell408.setCellStyle( centerstyle );
		HSSFCell cell409 = row5.createCell( 9 );
		cell409.setCellValue( new HSSFRichTextString( "" ) );
		cell409.setCellStyle( centerstyle );
		HSSFCell cell410 = row5.createCell( 10 );
		cell410.setCellValue( new HSSFRichTextString( "" ) );
		cell410.setCellStyle( centerstyle );
		HSSFCell cell411 = row5.createCell( 11 );
		cell411.setCellValue( new HSSFRichTextString( "" ) );
		cell411.setCellStyle( centerstyle );
		HSSFCell cell412 = row5.createCell( 12 );
		cell412.setCellValue( new HSSFRichTextString( "" ) );
		cell412.setCellStyle( centerstyle );
		HSSFCell cell413 = row5.createCell( 13 );
		cell413.setCellValue( new HSSFRichTextString( "" ) );
		cell413.setCellStyle( centerstyle );
		HSSFCell cell414 = row5.createCell( 14 );
		cell414.setCellValue( new HSSFRichTextString( "" ) );
		cell414.setCellStyle( centerstyle );
		HSSFCell cell415 = row5.createCell( 15 );
		cell415.setCellValue( new HSSFRichTextString( "" ) );
		cell415.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 6, 0, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 5, 8, 15 ) );//合并
		// 创建第六行
		HSSFRow row6 = sheet.createRow( num + 6 ); // 设置行高
		row6.setHeight( (short) 600 ); // 创建列
		HSSFCell cell500 = row6.createCell( 0 );
		cell500.setCellValue( new HSSFRichTextString( "" ) );
		cell500.setCellStyle( centerstyle );
		HSSFCell cell501 = row6.createCell( 1 );
		cell501.setCellValue( new HSSFRichTextString( "" ) );
		cell501.setCellStyle( centerstyle );
		HSSFCell cell502 = row6.createCell( 2 );
		cell502.setCellValue( new HSSFRichTextString( "" ) );
		cell502.setCellStyle( centerstyle );
		HSSFCell cell503 = row6.createCell( 3 );
		cell503.setCellValue( new HSSFRichTextString( "" ) );
		cell503.setCellStyle( centerstyle );
		HSSFCell cell504 = row6.createCell( 4 );
		cell504.setCellValue( new HSSFRichTextString( "" ) );
		cell504.setCellStyle( centerstyle );
		HSSFCell cell505 = row6.createCell( 5 );
		cell505.setCellValue( new HSSFRichTextString( "" ) );
		cell505.setCellStyle( centerstyle );
		HSSFCell cell506 = row6.createCell( 6 );
		cell506.setCellValue( new HSSFRichTextString( "" ) );
		cell506.setCellStyle( centerstyle );
		HSSFCell cell507 = row6.createCell( 7 );
		cell507.setCellValue( new HSSFRichTextString( "" ) );
		cell507.setCellStyle( centerstyle );
		HSSFCell cell508 = row6.createCell( 8 );
		cell508.setCellValue( new HSSFRichTextString( "十" ) );
		cell508.setCellStyle( centerstyle );
		HSSFCell cell509 = row6.createCell( 9 );
		cell509.setCellValue( new HSSFRichTextString( "万" ) );
		cell509.setCellStyle( centerstyle );
		HSSFCell cell510 = row6.createCell( 10 );
		cell510.setCellValue( new HSSFRichTextString( "千" ) );
		cell510.setCellStyle( centerstyle );
		HSSFCell cell511 = row6.createCell( 11 );
		cell511.setCellValue( new HSSFRichTextString( "百" ) );
		cell511.setCellStyle( centerstyle );
		HSSFCell cell512 = row6.createCell( 12 );
		cell512.setCellValue( new HSSFRichTextString( "十" ) );
		cell512.setCellStyle( centerstyle );
		HSSFCell cell513 = row6.createCell( 13 );
		cell513.setCellValue( new HSSFRichTextString( "元" ) );
		cell513.setCellStyle( centerstyle );
		HSSFCell cell514 = row6.createCell( 14 );
		cell514.setCellValue( new HSSFRichTextString( "角" ) );
		cell514.setCellStyle( centerstyle );
		HSSFCell cell515 = row6.createCell( 15 );
		cell515.setCellValue( new HSSFRichTextString( "分" ) );
		cell515.setCellStyle( centerstyle );
		//******************循环插值  7行开始******************************************************************
		Integer bxfymxVOListsize = bxfymxVOList.size();
		if (bxfymxVOListsize > fyLength) {
			fyLength = bxfymxVOListsize;
		}
		for (int i = 0; i < fyLength; i++) {
			// 创建第七行
			Integer j = 7 + num + i;
			String zy = "";
			String aa = "";
			//		 十	万	千	百	十	元	.角	分
			String s1 = "";
			String w = "";
			String q = "";
			String b = "";
			String s2 = "";
			String y = "";
			String jj = "";
			String f = "";
			if (i < bxfymxVOListsize) {
				BxfymxVO bxfymxVO = bxfymxVOList.get( i );
				if(bs==-1){
					if (fplx == 0) {
						aa = bxfymxVO.getFybxdje() + "";
						zy = bxfymxVO.getFylxName();
					} else {
						aa = bxfymxVO.getTbfybxdje() + "";
						zy = bxfymxVO.getTbfylxName();
					}
				}else{
					aa= bxfymxVO.getFybxdje()==null?bxfymxVO.getTbfybxdje()+"":bxfymxVO.getFybxdje()+"";
					zy= bxfymxVO.getFylxName()==null?bxfymxVO.getTbfylxName()+"":bxfymxVO.getFylxName()+"";
				}
				String[] bb = aa.split( "\\." );
				for (int ii = 0; ii < bb[0].length(); ii++) {
					if (ii == 0) {
						y = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						s2 = "¥";
					}
					if (ii == 1) {
						s2 = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						b = "¥";
					}
					if (ii == 2) {
						b = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						q = "¥";
					}
					if (ii == 3) {
						q = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						w = "¥";
					}
					if (ii == 4) {
						w = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						s1 = "¥";
					}
					if (ii == 5) {
						s1 = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
					}
				}
				for (int ii = 0; ii < bb[1].length(); ii++) {
					if (ii == 0) {
						jj = bb[1].substring( 0, 1 );
						f = "0";
					}
					if (ii == 1) {
						jj = bb[1].substring( 0, 1 );
						f = bb[1].substring( 1, 2 );

					}
				}
			}
			HSSFRow row7 = sheet.createRow( j ); // 设置行高
			row7.setHeight( (short) 600 ); // 创建列
			HSSFCell cell600 = row7.createCell( 0 );
			cell600.setCellValue( new HSSFRichTextString( zy ) );
			cell600.setCellStyle( centerstyle );
			HSSFCell cell601 = row7.createCell( 1 );
			cell601.setCellValue( new HSSFRichTextString( "" ) );
			cell601.setCellStyle( centerstyle );
			HSSFCell cell602 = row7.createCell( 2 );
			cell602.setCellValue( new HSSFRichTextString( "" ) );
			cell602.setCellStyle( centerstyle );
			HSSFCell cell603 = row7.createCell( 3 );
			cell603.setCellValue( new HSSFRichTextString( "" ) );
			cell603.setCellStyle( centerstyle );
			HSSFCell cell604 = row7.createCell( 4 );
			cell604.setCellValue( new HSSFRichTextString( "" ) );
			cell604.setCellStyle( centerstyle );
			HSSFCell cell605 = row7.createCell( 5 );
			cell605.setCellValue( new HSSFRichTextString( "" ) );
			cell605.setCellStyle( centerstyle );
			HSSFCell cell606 = row7.createCell( 6 );
			cell606.setCellValue( new HSSFRichTextString( "" ) );
			cell606.setCellStyle( centerstyle );
			HSSFCell cell607 = row7.createCell( 7 );
			cell607.setCellValue( new HSSFRichTextString( "" ) );
			cell607.setCellStyle( centerstyle );
			HSSFCell cell608 = row7.createCell( 8 );
			cell608.setCellValue( new HSSFRichTextString( s1 ) );
			cell608.setCellStyle( centerstyle );
			HSSFCell cell609 = row7.createCell( 9 );
			cell609.setCellValue( new HSSFRichTextString( w ) );
			cell609.setCellStyle( centerstyle );
			HSSFCell cell610 = row7.createCell( 10 );
			cell610.setCellValue( new HSSFRichTextString( q ) );
			cell610.setCellStyle( centerstyle );
			HSSFCell cell611 = row7.createCell( 11 );
			cell611.setCellValue( new HSSFRichTextString( b ) );
			cell611.setCellStyle( centerstyle );
			HSSFCell cell612 = row7.createCell( 12 );
			cell612.setCellValue( new HSSFRichTextString( s2 ) );
			cell612.setCellStyle( centerstyle );
			HSSFCell cell613 = row7.createCell( 13 );
			cell613.setCellValue( new HSSFRichTextString( y ) );
			cell613.setCellStyle( centerstyle );
			HSSFCell cell614 = row7.createCell( 14 );
			cell614.setCellValue( new HSSFRichTextString( jj ) );
			cell614.setCellStyle( centerstyle );
			HSSFCell cell615 = row7.createCell( 15 );
			cell615.setCellValue( new HSSFRichTextString( f ) );
			cell615.setCellStyle( centerstyle );
			sheet.addMergedRegion( new CellRangeAddress( j, j, 0, 7 ) );//合并
		}
		//****************** 表底 ******************************************************************
//	循环后下一行
		String bxzjedx = "";
		//处理总金额大写
		if (bs == 1) {
			bxzjedx = bxvo.getBxzje() + "";
		} else {
			if (fplx == 0) {
				bxzjedx = bxvo.getBxzje() + "";
			} else {
				bxzjedx = bxvo.getTbbxzje() + "";
			}
		}

		//		 十	万	千	百	十	元	.角	分 ---大写
		String s1DX = "";
		String wDX = "";
		String qDX = "";
		String bDX = "";
		String s2DX = "";
		String yDX = "";
		String jjDX = "";
		String fDX = "";
		String[] bbDX = bxzjedx.split( "\\." );
		for (int iiDX = 0; iiDX < bbDX[0].length(); iiDX++) {
			if (iiDX == 0) {
				yDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				s2DX = "¥";
			}
			if (iiDX == 1) {
				s2DX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				bDX = "¥";
			}
			if (iiDX == 2) {
				bDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				qDX = "¥";
			}
			if (iiDX == 3) {
				qDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				wDX = "¥";
			}
			if (iiDX == 4) {
				wDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				s1DX = "¥";
			}
			if (iiDX == 5) {
				s1DX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
			}
		}
		for (int iiDX = 0; iiDX < bbDX[1].length(); iiDX++) {
			if (iiDX == 0) {
				jjDX = bbDX[1].substring( 0, 1 );
				fDX = "零";
			}
			if (iiDX == 1) {
				jjDX = bbDX[1].substring( 0, 1 );
				fDX = bbDX[1].substring( 1, 2 );

			}
		}
		HSSFRow row8 = sheet.createRow( 7 + num + fyLength ); // 设置行高
		row8.setHeight( (short) 600 ); // 创建列
		HSSFCell cell700 = row8.createCell( 0 );
		if (fplx == 0) { //发票类型（有票无票 1有票 0无
			cell700.setCellValue( new HSSFRichTextString( "合计人民币（大写）  " + bxvo.getBxzjedx() ) );
			//cell700.setCellValue( new StringBuilder().append( "合计人民币（大写） " ).append( bxvo.getTbbxzjedx().contains( "分" ) ? bxvo.getTbbxzjedx() : bxvo.getTbbxzjedx() ).toString() );
		} else {
			cell700.setCellValue( new HSSFRichTextString( "合计人民币（大写）  " + bxvo.getTbbxzjedx() ) );
			//cell700.setCellValue( new StringBuilder().append( "合计人民币（大写） " ).append( bxvo.getBxzjedx().contains( "分" ) ? bxvo.getBxzjedx() : bxvo.getBxzjedx() ).toString() );

		}
		cell700.setCellStyle( leftstyle );
		HSSFCell cell701 = row8.createCell( 1 );
		cell701.setCellValue( new HSSFRichTextString( "" ) );
		cell701.setCellStyle( centerstyle );
		HSSFCell cell702 = row8.createCell( 2 );
		cell702.setCellValue( new HSSFRichTextString( "" ) );
		cell702.setCellStyle( centerstyle );
		HSSFCell cell703 = row8.createCell( 3 );
		cell703.setCellValue( new HSSFRichTextString( "" ) );
		cell703.setCellStyle( centerstyle );
		HSSFCell cell704 = row8.createCell( 4 );
		cell704.setCellValue( new HSSFRichTextString( "" ) );
		cell704.setCellStyle( centerstyle );
		HSSFCell cell705 = row8.createCell( 5 );
		cell705.setCellValue( new HSSFRichTextString( "" ) );
		cell705.setCellStyle( centerstyle );
		HSSFCell cell706 = row8.createCell( 6 );
		cell706.setCellValue( new HSSFRichTextString( "" ) );
		cell706.setCellStyle( centerstyle );
		HSSFCell cell707 = row8.createCell( 7 );
		cell707.setCellValue( new HSSFRichTextString( "" ) );
		cell707.setCellStyle( centerstyle );
		HSSFCell cell708 = row8.createCell( 8 );
		cell708.setCellValue( new HSSFRichTextString( s1DX ) );
		cell708.setCellStyle( centerstyle );
		HSSFCell cell709 = row8.createCell( 9 );
		cell709.setCellValue( new HSSFRichTextString( wDX ) );
		cell709.setCellStyle( centerstyle );
		HSSFCell cell710 = row8.createCell( 10 );
		cell710.setCellValue( new HSSFRichTextString( qDX ) );
		cell710.setCellStyle( centerstyle );
		HSSFCell cell711 = row8.createCell( 11 );
		cell711.setCellValue( new HSSFRichTextString( bDX ) );
		cell711.setCellStyle( centerstyle );
		HSSFCell cell712 = row8.createCell( 12 );
		cell712.setCellValue( new HSSFRichTextString( s2DX ) );
		cell712.setCellStyle( centerstyle );
		HSSFCell cell713 = row8.createCell( 13 );
		cell713.setCellValue( new HSSFRichTextString( yDX ) );
		cell713.setCellStyle( centerstyle );
		HSSFCell cell714 = row8.createCell( 14 );
		cell714.setCellValue( new HSSFRichTextString( jjDX ) );
		cell714.setCellStyle( centerstyle );
		HSSFCell cell715 = row8.createCell( 15 );
		cell715.setCellValue( new HSSFRichTextString( fDX ) );
		cell715.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 7 + fyLength, num + 7 + fyLength, 0, 7 ) );//合并
//最后一行
		HSSFRow row9 = sheet.createRow( 8 + num + fyLength ); // 设置行高
		row9.setHeight( (short) 600 );
		HSSFCell cell800 = row9.createCell( 0 );// 创建列
		cell800.setCellValue( new HSSFRichTextString( "批准人:" + bxvo.getPzrqm() + "             " + "出纳:" + "             " + "复核人:" + bxvo.getFhrqm() + "             " + "审核人:" + bxvo.getShrqm() + "             " + "报销人:" + bxvo.getBxrqm() + "             " ) );
		cell800.setCellStyle( leftstyle );
		HSSFCell cell801 = row9.createCell( 1 );
		cell801.setCellValue( new HSSFRichTextString( "" ) );
		cell801.setCellStyle( centerstyle );
		HSSFCell cell802 = row9.createCell( 2 );
		cell802.setCellValue( new HSSFRichTextString( "" ) );
		cell802.setCellStyle( centerstyle );
		HSSFCell cell803 = row9.createCell( 3 );
		cell803.setCellValue( new HSSFRichTextString( "" ) );
		cell803.setCellStyle( centerstyle );
		HSSFCell cell804 = row9.createCell( 4 );
		cell804.setCellValue( new HSSFRichTextString( "" ) );
		cell804.setCellStyle( centerstyle );
		HSSFCell cell805 = row9.createCell( 5 );
		cell805.setCellValue( new HSSFRichTextString( "" ) );
		cell805.setCellStyle( centerstyle );
		HSSFCell cell806 = row9.createCell( 6 );
		cell806.setCellValue( new HSSFRichTextString( "" ) );
		cell806.setCellStyle( centerstyle );
		HSSFCell cell807 = row9.createCell( 7 );
		cell807.setCellValue( new HSSFRichTextString( "" ) );
		cell807.setCellStyle( centerstyle );
		HSSFCell cell808 = row9.createCell( 8 );
		cell808.setCellValue( new HSSFRichTextString( "" ) );
		cell808.setCellStyle( centerstyle );
		HSSFCell cell809 = row9.createCell( 9 );
		cell809.setCellValue( new HSSFRichTextString( "" ) );
		cell809.setCellStyle( centerstyle );
		HSSFCell cell810 = row9.createCell( 10 );
		cell810.setCellValue( new HSSFRichTextString( "" ) );
		cell810.setCellStyle( centerstyle );
		HSSFCell cell811 = row9.createCell( 11 );
		cell811.setCellValue( new HSSFRichTextString( "" ) );
		cell811.setCellStyle( centerstyle );
		HSSFCell cell812 = row9.createCell( 12 );
		cell812.setCellValue( new HSSFRichTextString( "" ) );
		cell812.setCellStyle( centerstyle );
		HSSFCell cell813 = row9.createCell( 13 );
		cell813.setCellValue( new HSSFRichTextString( "" ) );
		cell813.setCellStyle( centerstyle );
		HSSFCell cell814 = row9.createCell( 14 );
		cell814.setCellValue( new HSSFRichTextString( "" ) );
		cell814.setCellStyle( centerstyle );
		HSSFCell cell815 = row9.createCell( 15 );
		cell815.setCellValue( new HSSFRichTextString( "" ) );
		cell815.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 8 + num + fyLength, 8 + num + fyLength, 0, 15 ) );//合并
		return 8 + num + fyLength;
	}

	/**
	 * 新增住宿费用报销单
	 *
	 * @param num         起始行数
	 * @param sheet
	 * @param headstyle
	 * @param centerstyle
	 */
	private Integer addzszpbxd(BxVo bxvo, List<BxzszpmxVO> bxzszpmxVOList, Integer num, Integer fyLength, HSSFSheet sheet, HSSFCellStyle headstyle, HSSFCellStyle centerstyle, HSSFCellStyle leftstyle, HSSFCellStyle columnHeadStyle,HSSFCellStyle leftstyle10) {
		Integer sfglxc = bxzszpmxVOList.get( 0 ).getSfglxc();//是否关联差旅
		String glbxbh = "";
		if (sfglxc == 1) {
			glbxbh = this.getById( bxzszpmxVOList.get( 0 ).getClbxdid() ).getBxbh();
		}
		SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
		SimpleDateFormat yymmdd = new SimpleDateFormat( "yyyy-MM-dd" );
		SimpleDateFormat mmdd = new SimpleDateFormat( "MM月dd日" );
		//创建第一行表头
		//**********************头部***************************************************************
		String xmbh = bxzszpmxVOList.stream().map( p -> p.getXmbh() ).distinct().collect( Collectors.joining( "," ) );
		String xmmc = bxzszpmxVOList.stream().map( p -> p.getXmbhAbbName()== null ? "": p.getXmbhAbbName() ).distinct().collect( Collectors.joining( "," ) );

		HSSFRow row0 = sheet.createRow( num + 0 );// 创建第一行无数据行
		//row0.setHeight((short) 350);// 设置行高
		if (num > 1 && num % 2 == 0) {
			row0.setHeight( (short) 1478 );// 设置行高
		} else {
			row0.setHeight( (short) 526 );// 设置行高
		}
		HSSFRow row1 = sheet.createRow( num + 1 );// 创建第一行
		row1.setHeight( (short) 650 );// 设置行高
		HSSFCell cell0 = row1.createCell( 0 );
		cell0.setCellValue( new HSSFRichTextString( "费用报销单（专票住宿专用）" ) );
		cell0.setCellStyle( headstyle );
		HSSFCell cell01 = row1.createCell( 1 );
		cell01.setCellValue( new HSSFRichTextString( "" ) );
		cell01.setCellStyle( headstyle );
		HSSFCell cell02 = row1.createCell( 2 );
		cell02.setCellValue( new HSSFRichTextString( "" ) );
		cell02.setCellStyle( headstyle );
		HSSFCell cell03 = row1.createCell( 3 );
		cell03.setCellValue( new HSSFRichTextString( "" ) );
		cell03.setCellStyle( headstyle );
		HSSFCell cell04 = row1.createCell( 4 );
		cell04.setCellValue( new HSSFRichTextString( "" ) );
		cell04.setCellStyle( headstyle );
		HSSFCell cell05 = row1.createCell( 5 );
		cell05.setCellValue( new HSSFRichTextString( "" ) );
		cell05.setCellStyle( headstyle );
		HSSFCell cell06 = row1.createCell( 6 );
		cell06.setCellValue( new HSSFRichTextString( "" ) );
		cell06.setCellStyle( headstyle );
		HSSFCell cell07 = row1.createCell( 7 );
		cell07.setCellValue( new HSSFRichTextString( "" ) );
		cell07.setCellStyle( headstyle );
		HSSFCell cell08 = row1.createCell( 8 );
		cell08.setCellValue( new HSSFRichTextString( "" ) );
		cell08.setCellStyle( headstyle );
		HSSFCell cell09 = row1.createCell( 9 );
		cell09.setCellValue( new HSSFRichTextString( "" ) );
		cell09.setCellStyle( headstyle );
		HSSFCell cell10 = row1.createCell( 10 );
		cell10.setCellValue( new HSSFRichTextString( "" ) );
		cell10.setCellStyle( headstyle );
		HSSFCell cell11 = row1.createCell( 11 );
		cell11.setCellValue( new HSSFRichTextString( "" ) );
		cell11.setCellStyle( headstyle );
		HSSFCell cell12 = row1.createCell( 12 );
		cell12.setCellValue( new HSSFRichTextString( "" ) );
		cell12.setCellStyle( headstyle );
		HSSFCell cell13 = row1.createCell( 13 );
		cell13.setCellValue( new HSSFRichTextString( "" ) );
		cell13.setCellStyle( headstyle );
		HSSFCell cell14 = row1.createCell( 14 );
		cell14.setCellValue( new HSSFRichTextString( "" ) );
		cell14.setCellStyle( headstyle );
		HSSFCell cell15 = row1.createCell( 15 );
		cell15.setCellValue( new HSSFRichTextString( "" ) );
		cell15.setCellStyle( headstyle );
		/**
		 * 合并单元格
		 *    第一个参数：第一个单元格的行数（从0开始）
		 *    第二个参数：第二个单元格的行数（从0开始）
		 *    第三个参数：第一个单元格的列数（从0开始）
		 *    第四个参数：第二个单元格的列数（从0开始）
		 */
		String bxbh = bxvo.getBxbh();
		String bxr = bxvo.getBxrName();
		String bxrq = bxvo.getBxrq() == null ? "" : yymmdd.format( bxvo.getBxrq() );
		sheet.addMergedRegion( new CellRangeAddress( num + 1, num + 1, 0, 15 ) );//合并
		HSSFRow row2 = sheet.createRow( num + 2 );// 创建第二行无数据行
		// 创建第三行
		HSSFRow row3 = sheet.createRow( num + 3 );
		row3.setHeight( (short) 600 );// 设置行高
		// 创建列
		HSSFCell cell200 = row3.createCell( 0 );
		cell200.setCellValue( new HSSFRichTextString( "报销编号" ) );
		cell200.setCellStyle( centerstyle );
		HSSFCell cell201 = row3.createCell( 1 );
		cell201.setCellValue( new HSSFRichTextString( "" ) );
		cell201.setCellStyle( centerstyle );
		HSSFCell cell202 = row3.createCell( 2 );
		cell202.setCellValue( new HSSFRichTextString( bxbh ) );
		cell202.setCellStyle( centerstyle );
		HSSFCell cell203 = row3.createCell( 3 );
		cell203.setCellValue( new HSSFRichTextString( "" ) );
		cell203.setCellStyle( centerstyle );
		HSSFCell cell204 = row3.createCell( 4 );
		cell204.setCellValue( new HSSFRichTextString( "" ) );
		cell204.setCellStyle( centerstyle );
		HSSFCell cell205 = row3.createCell( 5 );
		cell205.setCellValue( new HSSFRichTextString( "" ) );
		cell205.setCellStyle( centerstyle );
		HSSFCell cell206 = row3.createCell( 6 );
		cell206.setCellValue( new HSSFRichTextString( "" ) );
		cell206.setCellStyle( centerstyle );
		HSSFCell cell207 = row3.createCell( 7 );
		cell207.setCellValue( new HSSFRichTextString( "" ) );
		cell207.setCellStyle( centerstyle );
		HSSFCell cell208 = row3.createCell( 8 );
		if (sfglxc == 1) cell208.setCellValue( new HSSFRichTextString( "差旅编号" ) );
		else cell208.setCellValue( new HSSFRichTextString( "部门" ) );
		cell208.setCellStyle( centerstyle );
		HSSFCell cell209 = row3.createCell( 9 );
		cell209.setCellValue( new HSSFRichTextString( "" ) );
		cell209.setCellStyle( centerstyle );
		HSSFCell cell210 = row3.createCell( 10 );
		if (sfglxc == 1) cell210.setCellValue( new HSSFRichTextString( glbxbh ) );
		else cell210.setCellValue( new HSSFRichTextString( bxvo.getBmidName() ) );
		cell210.setCellStyle( centerstyle );
		HSSFCell cell211 = row3.createCell( 11 );
		cell211.setCellValue( new HSSFRichTextString( "" ) );
		cell211.setCellStyle( centerstyle );
		HSSFCell cell212 = row3.createCell( 12 );
		cell212.setCellValue( new HSSFRichTextString( "" ) );
		cell212.setCellStyle( centerstyle );
		HSSFCell cell213 = row3.createCell( 13 );
		cell213.setCellValue( new HSSFRichTextString( "" ) );
		cell213.setCellStyle( centerstyle );
		HSSFCell cell214 = row3.createCell( 14 );
		cell214.setCellValue( new HSSFRichTextString( "" ) );
		cell214.setCellStyle( centerstyle );
		HSSFCell cell215 = row3.createCell( 15 );
		cell215.setCellValue( new HSSFRichTextString( "" ) );
		cell215.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 10, 15 ) );//合并
//		sheet.addMergedRegion(new CellRangeAddress(num+3, num+3, 2, 15));//合并

		num = num + 1;

		//插入一行报销项目编号与项目名称
		HSSFRow row30 = sheet.createRow( num + 3 );
		row30.setHeight( (short) 600 );// 设置行高
		// 创建列
		HSSFCell cell2000 = row30.createCell( 0 );
		cell2000.setCellValue( new HSSFRichTextString( "出差事由" ) );
		cell2000.setCellStyle( centerstyle );
		HSSFCell cell2010 = row30.createCell( 1 );
		cell2010.setCellValue( new HSSFRichTextString( "" ) );
		cell2010.setCellStyle( centerstyle );
		HSSFCell cell2020 = row30.createCell( 2 );
		cell2020.setCellValue( new HSSFRichTextString( bxvo.getCcsyName() ) );
		cell2020.setCellStyle( centerstyle );
		HSSFCell cell2030 = row30.createCell( 3 );
		cell2030.setCellValue( new HSSFRichTextString( "" ) );
		cell2030.setCellStyle( centerstyle );
		HSSFCell cell2040 = row30.createCell( 4 );
		cell2040.setCellValue( new HSSFRichTextString( "" ) );
		cell2040.setCellStyle( centerstyle );
		HSSFCell cell2050 = row30.createCell( 5 );
		cell2050.setCellValue( new HSSFRichTextString( "" ) );
		cell2050.setCellStyle( centerstyle );
		HSSFCell cell2060 = row30.createCell( 6 );
		cell2060.setCellValue( new HSSFRichTextString( "" ) );
		cell2060.setCellStyle( centerstyle );
		HSSFCell cell2070 = row30.createCell( 7 );
		cell2070.setCellValue( new HSSFRichTextString( "" ) );
		cell2070.setCellStyle( centerstyle );
		HSSFCell cell2080 = row30.createCell( 8 );
		cell2080.setCellValue( new HSSFRichTextString( "票据张数" ) );
		cell2080.setCellStyle( centerstyle );
		HSSFCell cell2090 = row30.createCell( 9 );
		cell2090.setCellValue( new HSSFRichTextString( "" ) );
		cell2090.setCellStyle( centerstyle );
		HSSFCell cell2100 = row30.createCell( 10 );
		cell2100.setCellValue( new HSSFRichTextString( bxvo.getBillCount()+"张") );
		cell2100.setCellStyle( centerstyle );
		HSSFCell cell2110 = row30.createCell( 11 );
		cell2110.setCellValue( new HSSFRichTextString( "" ) );
		cell2110.setCellStyle( centerstyle );
		HSSFCell cell2120 = row30.createCell( 12 );
		cell2120.setCellValue( new HSSFRichTextString( "" ) );
		cell2120.setCellStyle( centerstyle );
		HSSFCell cell2130 = row30.createCell( 13 );
		cell2130.setCellValue( new HSSFRichTextString( "" ) );
		cell2130.setCellStyle( centerstyle );
		HSSFCell cell2140 = row30.createCell( 14 );
		cell2140.setCellValue( new HSSFRichTextString( "" ) );
		cell2140.setCellStyle( centerstyle );
		HSSFCell cell2150 = row30.createCell( 15 );
		cell2150.setCellValue( new HSSFRichTextString( "" ) );
		cell2150.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 3, num + 3, 10, 15 ) );//合并


		// 创建第四行
		HSSFRow row4 = sheet.createRow( num + 4 ); // 设置行高
		row4.setHeight( (short) 600 ); // 创建列
		HSSFCell cell300 = row4.createCell( 0 );
		cell300.setCellValue( new HSSFRichTextString( "报销人" ) );
		cell300.setCellStyle( centerstyle );
		HSSFCell cell301 = row4.createCell( 1 );
		cell301.setCellValue( new HSSFRichTextString( "" ) );
		cell301.setCellStyle( centerstyle );
		HSSFCell cell302 = row4.createCell( 2 );
		cell302.setCellValue( new HSSFRichTextString( bxr ) );
		cell302.setCellStyle( centerstyle );
		HSSFCell cell303 = row4.createCell( 3 );
		cell303.setCellValue( new HSSFRichTextString( "" ) );
		cell303.setCellStyle( centerstyle );
		HSSFCell cell304 = row4.createCell( 4 );
		cell304.setCellValue( new HSSFRichTextString( "" ) );
		cell304.setCellStyle( centerstyle );
		HSSFCell cell305 = row4.createCell( 5 );
		cell305.setCellValue( new HSSFRichTextString( "" ) );
		cell305.setCellStyle( centerstyle );
		HSSFCell cell306 = row4.createCell( 6 );
		cell306.setCellValue( new HSSFRichTextString( "" ) );
		cell306.setCellStyle( centerstyle );
		HSSFCell cell307 = row4.createCell( 7 );
		cell307.setCellValue( new HSSFRichTextString( "" ) );
		cell307.setCellStyle( centerstyle );
		HSSFCell cell308 = row4.createCell( 8 );
		cell308.setCellValue( new HSSFRichTextString( "报销日期" ) );
		cell308.setCellStyle( centerstyle );
		HSSFCell cell309 = row4.createCell( 9 );
		cell309.setCellValue( new HSSFRichTextString( "" ) );
		cell309.setCellStyle( centerstyle );
		HSSFCell cell310 = row4.createCell( 10 );
		cell310.setCellValue( new HSSFRichTextString( bxrq ) );
		cell310.setCellStyle( centerstyle );
		HSSFCell cell311 = row4.createCell( 11 );
		cell311.setCellValue( new HSSFRichTextString( "" ) );
		cell311.setCellStyle( centerstyle );
		HSSFCell cell312 = row4.createCell( 12 );
		cell312.setCellValue( new HSSFRichTextString( "" ) );
		cell312.setCellStyle( centerstyle );
		HSSFCell cell313 = row4.createCell( 13 );
		cell313.setCellValue( new HSSFRichTextString( "" ) );
		cell313.setCellStyle( centerstyle );
		HSSFCell cell314 = row4.createCell( 14 );
		cell314.setCellValue( new HSSFRichTextString( "" ) );
		cell314.setCellStyle( centerstyle );
		HSSFCell cell315 = row4.createCell( 15 );
		cell315.setCellValue( new HSSFRichTextString( "" ) );
		cell315.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 0, 1 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 2, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 8, 9 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 4, num + 4, 10, 15 ) );//合并
		// 创建第五行
		HSSFRow row5 = sheet.createRow( num + 5 ); // 设置行高
		row5.setHeight( (short) 600 ); // 创建列
		HSSFCell cell400 = row5.createCell( 0 );
		cell400.setCellValue( new HSSFRichTextString( "摘要" ) );
		cell400.setCellStyle( columnHeadStyle );
		HSSFCell cell401 = row5.createCell( 1 );
		cell401.setCellValue( new HSSFRichTextString( "" ) );
		cell401.setCellStyle( centerstyle );
		HSSFCell cell402 = row5.createCell( 2 );
		cell402.setCellValue( new HSSFRichTextString( "" ) );
		cell402.setCellStyle( centerstyle );
		HSSFCell cell403 = row5.createCell( 3 );
		cell403.setCellValue( new HSSFRichTextString( "" ) );
		cell403.setCellStyle( centerstyle );
		HSSFCell cell404 = row5.createCell( 4 );
		cell404.setCellValue( new HSSFRichTextString( "" ) );
		cell404.setCellStyle( centerstyle );
		HSSFCell cell405 = row5.createCell( 5 );
		cell405.setCellValue( new HSSFRichTextString( "" ) );
		cell405.setCellStyle( centerstyle );
		HSSFCell cell406 = row5.createCell( 6 );
		cell406.setCellValue( new HSSFRichTextString( "" ) );
		cell406.setCellStyle( centerstyle );
		HSSFCell cell407 = row5.createCell( 7 );
		cell407.setCellValue( new HSSFRichTextString( "" ) );
		cell407.setCellStyle( centerstyle );
		HSSFCell cell408 = row5.createCell( 8 );
		cell408.setCellValue( new HSSFRichTextString( "金额" ) );
		cell408.setCellStyle( centerstyle );
		HSSFCell cell409 = row5.createCell( 9 );
		cell409.setCellValue( new HSSFRichTextString( "" ) );
		cell409.setCellStyle( centerstyle );
		HSSFCell cell410 = row5.createCell( 10 );
		cell410.setCellValue( new HSSFRichTextString( "" ) );
		cell410.setCellStyle( centerstyle );
		HSSFCell cell411 = row5.createCell( 11 );
		cell411.setCellValue( new HSSFRichTextString( "" ) );
		cell411.setCellStyle( centerstyle );
		HSSFCell cell412 = row5.createCell( 12 );
		cell412.setCellValue( new HSSFRichTextString( "" ) );
		cell412.setCellStyle( centerstyle );
		HSSFCell cell413 = row5.createCell( 13 );
		cell413.setCellValue( new HSSFRichTextString( "" ) );
		cell413.setCellStyle( centerstyle );
		HSSFCell cell414 = row5.createCell( 14 );
		cell414.setCellValue( new HSSFRichTextString( "" ) );
		cell414.setCellStyle( centerstyle );
		HSSFCell cell415 = row5.createCell( 15 );
		cell415.setCellValue( new HSSFRichTextString( "" ) );
		cell415.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 6, 0, 7 ) );//合并
		sheet.addMergedRegion( new CellRangeAddress( num + 5, num + 5, 8, 15 ) );//合并
		// 创建第六行
		HSSFRow row6 = sheet.createRow( num + 6 ); // 设置行高
		row6.setHeight( (short) 600 ); // 创建列
		HSSFCell cell500 = row6.createCell( 0 );
		cell500.setCellValue( new HSSFRichTextString() );
		cell500.setCellStyle( centerstyle );
		HSSFCell cell501 = row6.createCell( 1 );
		cell501.setCellValue( new HSSFRichTextString( "" ) );
		cell501.setCellStyle( centerstyle );
		HSSFCell cell502 = row6.createCell( 2 );
		cell502.setCellValue( new HSSFRichTextString( "" ) );
		cell502.setCellStyle( centerstyle );
		HSSFCell cell503 = row6.createCell( 3 );
		cell503.setCellValue( new HSSFRichTextString( "" ) );
		cell503.setCellStyle( centerstyle );
		HSSFCell cell504 = row6.createCell( 4 );
		cell504.setCellValue( new HSSFRichTextString( "" ) );
		cell504.setCellStyle( centerstyle );
		HSSFCell cell505 = row6.createCell( 5 );
		cell505.setCellValue( new HSSFRichTextString( "" ) );
		cell505.setCellStyle( centerstyle );
		HSSFCell cell506 = row6.createCell( 6 );
		cell506.setCellValue( new HSSFRichTextString( "" ) );
		cell506.setCellStyle( centerstyle );
		HSSFCell cell507 = row6.createCell( 7 );
		cell507.setCellValue( new HSSFRichTextString( "" ) );
		cell507.setCellStyle( centerstyle );
		HSSFCell cell508 = row6.createCell( 8 );
		cell508.setCellValue( new HSSFRichTextString( "十" ) );
		cell508.setCellStyle( centerstyle );
		HSSFCell cell509 = row6.createCell( 9 );
		cell509.setCellValue( new HSSFRichTextString( "万" ) );
		cell509.setCellStyle( centerstyle );
		HSSFCell cell510 = row6.createCell( 10 );
		cell510.setCellValue( new HSSFRichTextString( "千" ) );
		cell510.setCellStyle( centerstyle );
		HSSFCell cell511 = row6.createCell( 11 );
		cell511.setCellValue( new HSSFRichTextString( "百" ) );
		cell511.setCellStyle( centerstyle );
		HSSFCell cell512 = row6.createCell( 12 );
		cell512.setCellValue( new HSSFRichTextString( "十" ) );
		cell512.setCellStyle( centerstyle );
		HSSFCell cell513 = row6.createCell( 13 );
		cell513.setCellValue( new HSSFRichTextString( "元" ) );
		cell513.setCellStyle( centerstyle );
		HSSFCell cell514 = row6.createCell( 14 );
		cell514.setCellValue( new HSSFRichTextString( "角" ) );
		cell514.setCellStyle( centerstyle );
		HSSFCell cell515 = row6.createCell( 15 );
		cell515.setCellValue( new HSSFRichTextString( "分" ) );
		cell515.setCellStyle( centerstyle );
		//******************循环插值  7行开始******************************************************************
		Integer bxzszpmxVOListsizs = bxzszpmxVOList.size();
		if (bxzszpmxVOListsizs > fyLength) {
			fyLength = bxzszpmxVOListsizs;
		}
//		十	万	千	百	十	元	角	分
		//		 十	万	千	百	十	元	.角	分

		for (int i = 0; i < fyLength; i++) {
			// 创建第七行
			Integer j = 7 + num + i;
			String je = "";
			String zy = "";
			String s1 = "";
			String w = "";
			String q = "";
			String b = "";
			String s2 = "";
			String y = "";
			String jj = "";
			String f = "";
			if (i < bxzszpmxVOListsizs) {
				BxzszpmxVO bxzszpmxVO = bxzszpmxVOList.get( i );
				zy = mmdd.format( bxzszpmxVO.getKssj() ) + "-" + mmdd.format( bxzszpmxVO.getJssj() ) + "(" + bxzszpmxVO.getDd() + ")";
				je = bxzszpmxVO.getJe().stripTrailingZeros().toPlainString().equals( "0" ) ? "" : bxzszpmxVO.getJe() + "";
				String[] bb = je.split( "\\." );
				for (int ii = 0; ii < bb[0].length(); ii++) {
					if (ii == 0) {
						y = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						s2 = "¥";
					}
					if (ii == 1) {
						s2 = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						b = "¥";
					}
					if (ii == 2) {
						b = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						q = "¥";
					}
					if (ii == 3) {
						q = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						w = "¥";
					}
					if (ii == 4) {
						w = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
						s1 = "¥";
					}
					if (ii == 5) {
						s1 = bb[0].substring( bb[0].length() - (ii + 1), bb[0].length() - ii );
					}
				}
				for (int ii = 0; ii < bb[1].length(); ii++) {
					if (ii == 0) {
						jj = bb[1].substring( 0, 1 );
						f = "0";
					}
					if (ii == 1) {
						jj = bb[1].substring( 0, 1 );
						f = bb[1].substring( 1, 2 );
					}
				}
			}
			HSSFRow row7 = sheet.createRow( j ); // 设置行高
			row7.setHeight( (short) 600 ); // 创建列
			HSSFCell cell600 = row7.createCell( 0 );
			cell600.setCellValue( new HSSFRichTextString( zy ) );
			cell600.setCellStyle( centerstyle );
			HSSFCell cell601 = row7.createCell( 1 );
			cell601.setCellValue( new HSSFRichTextString( "" ) );
			cell601.setCellStyle( centerstyle );
			HSSFCell cell602 = row7.createCell( 2 );
			cell602.setCellValue( new HSSFRichTextString( "" ) );
			cell602.setCellStyle( centerstyle );
			HSSFCell cell603 = row7.createCell( 3 );
			cell603.setCellValue( new HSSFRichTextString( "" ) );
			cell603.setCellStyle( centerstyle );
			HSSFCell cell604 = row7.createCell( 4 );
			cell604.setCellValue( new HSSFRichTextString( "" ) );
			cell604.setCellStyle( centerstyle );
			HSSFCell cell605 = row7.createCell( 5 );
			cell605.setCellValue( new HSSFRichTextString( "" ) );
			cell605.setCellStyle( centerstyle );
			HSSFCell cell606 = row7.createCell( 6 );
			cell606.setCellValue( new HSSFRichTextString( "" ) );
			cell606.setCellStyle( centerstyle );
			HSSFCell cell607 = row7.createCell( 7 );
			cell607.setCellValue( new HSSFRichTextString( "" ) );
			cell607.setCellStyle( centerstyle );
			HSSFCell cell608 = row7.createCell( 8 );
			cell608.setCellValue( new HSSFRichTextString( s1 ) );
			cell608.setCellStyle( centerstyle );
			HSSFCell cell609 = row7.createCell( 9 );
			cell609.setCellValue( new HSSFRichTextString( w ) );
			cell609.setCellStyle( centerstyle );
			HSSFCell cell610 = row7.createCell( 10 );
			cell610.setCellValue( new HSSFRichTextString( q ) );
			cell610.setCellStyle( centerstyle );
			HSSFCell cell611 = row7.createCell( 11 );
			cell611.setCellValue( new HSSFRichTextString( b ) );
			cell611.setCellStyle( centerstyle );
			HSSFCell cell612 = row7.createCell( 12 );
			cell612.setCellValue( new HSSFRichTextString( s2 ) );
			cell612.setCellStyle( centerstyle );
			HSSFCell cell613 = row7.createCell( 13 );
			cell613.setCellValue( new HSSFRichTextString( y ) );
			cell613.setCellStyle( centerstyle );
			HSSFCell cell614 = row7.createCell( 14 );
			cell614.setCellValue( new HSSFRichTextString( jj ) );
			cell614.setCellStyle( centerstyle );
			HSSFCell cell615 = row7.createCell( 15 );
			cell615.setCellValue( new HSSFRichTextString( f ) );
			cell615.setCellStyle( centerstyle );
			sheet.addMergedRegion( new CellRangeAddress( j, j, 0, 7 ) );//合并
		}
		//****************** 表底 ******************************************************************
//	循环后下一行
		String bxzje = "";
		//处理总金额大写
		bxzje = bxvo.getBxzje() + "";
		//		 十	万	千	百	十	元	.角	分 ---大写
		String s1DX = "";
		String wDX = "";
		String qDX = "";
		String bDX = "";
		String s2DX = "";
		String yDX = "";
		String jjDX = "";
		String fDX = "";
		String[] bbDX = bxzje.split( "\\." );
		for (int iiDX = 0; iiDX < bbDX[0].length(); iiDX++) {
			if (iiDX == 0) {
				yDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				s2DX = "¥";
			}
			if (iiDX == 1) {
				s2DX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				bDX = "¥";
			}
			if (iiDX == 2) {
				bDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				qDX = "¥";
			}
			if (iiDX == 3) {
				qDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				wDX = "¥";
			}
			if (iiDX == 4) {
				wDX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
				s1DX = "¥";
			}
			if (iiDX == 5) {
				s1DX = bbDX[0].substring( bbDX[0].length() - (iiDX + 1), bbDX[0].length() - iiDX );
			}
		}
		for (int iiDX = 0; iiDX < bbDX[1].length(); iiDX++) {
			if (iiDX == 0) {
				jjDX = bbDX[1].substring( 0, 1 );
				fDX = "0";
			}
			if (iiDX == 1) {
				jjDX = bbDX[1].substring( 0, 1 );
				fDX = bbDX[1].substring( 1, 2 );

			}
		}
		HSSFRow row8 = sheet.createRow( 7 + num + fyLength ); // 设置行高
		row8.setHeight( (short) 600 ); // 创建列
		HSSFCell cell700 = row8.createCell( 0 );
		cell700.setCellValue( new HSSFRichTextString( "合计人民币（大写）  " + bxvo.getBxzjedx() ) );
		//cell700.setCellValue( new StringBuilder().append( "合计人民币（大写） " ).append( bxvo.getBxzjedx().contains( "分" ) ? bxvo.getBxzjedx() : bxvo.getBxzjedx() + "整" ).toString() );
		cell700.setCellStyle( leftstyle );
		HSSFCell cell701 = row8.createCell( 1 );
		cell701.setCellValue( new HSSFRichTextString( "" ) );
		cell701.setCellStyle( centerstyle );
		HSSFCell cell702 = row8.createCell( 2 );
		cell702.setCellValue( new HSSFRichTextString( "" ) );
		cell702.setCellStyle( centerstyle );
		HSSFCell cell703 = row8.createCell( 3 );
		cell703.setCellValue( new HSSFRichTextString( "" ) );
		cell703.setCellStyle( centerstyle );
		HSSFCell cell704 = row8.createCell( 4 );
		cell704.setCellValue( new HSSFRichTextString( "" ) );
		cell704.setCellStyle( centerstyle );
		HSSFCell cell705 = row8.createCell( 5 );
		cell705.setCellValue( new HSSFRichTextString( "" ) );
		cell705.setCellStyle( centerstyle );
		HSSFCell cell706 = row8.createCell( 6 );
		cell706.setCellValue( new HSSFRichTextString( "" ) );
		cell706.setCellStyle( centerstyle );
		HSSFCell cell707 = row8.createCell( 7 );
		cell707.setCellValue( new HSSFRichTextString( "" ) );
		cell707.setCellStyle( centerstyle );
		HSSFCell cell708 = row8.createCell( 8 );
		cell708.setCellValue( new HSSFRichTextString( s1DX ) );
		cell708.setCellStyle( centerstyle );
		HSSFCell cell709 = row8.createCell( 9 );
		cell709.setCellValue( new HSSFRichTextString( wDX ) );
		cell709.setCellStyle( centerstyle );
		HSSFCell cell710 = row8.createCell( 10 );
		cell710.setCellValue( new HSSFRichTextString( qDX ) );
		cell710.setCellStyle( centerstyle );
		HSSFCell cell711 = row8.createCell( 11 );
		cell711.setCellValue( new HSSFRichTextString( bDX ) );
		cell711.setCellStyle( centerstyle );
		HSSFCell cell712 = row8.createCell( 12 );
		cell712.setCellValue( new HSSFRichTextString( s2DX ) );
		cell712.setCellStyle( centerstyle );
		HSSFCell cell713 = row8.createCell( 13 );
		cell713.setCellValue( new HSSFRichTextString( yDX ) );
		cell713.setCellStyle( centerstyle );
		HSSFCell cell714 = row8.createCell( 14 );
		cell714.setCellValue( new HSSFRichTextString( jjDX ) );
		cell714.setCellStyle( centerstyle );
		HSSFCell cell715 = row8.createCell( 15 );
		cell715.setCellValue( new HSSFRichTextString( fDX ) );
		cell715.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( num + 7 + fyLength, num + 7 + fyLength, 0, 7 ) );//合并
//最后一行
		HSSFRow row9 = sheet.createRow( 8 + num + fyLength ); // 设置行高
		row9.setHeight( (short) 600 );
		HSSFCell cell800 = row9.createCell( 0 );// 创建列
		cell800.setCellValue( new HSSFRichTextString( "批准人:" + bxvo.getPzrqm() + "             " + "出纳:" + "             " + "复核人:" + bxvo.getFhrqm() + "             " + "审核人:" + bxvo.getShrqm() + "             " + "报销人:" + bxvo.getBxrqm() + "             " ) );
		cell800.setCellStyle( leftstyle );
		HSSFCell cell801 = row9.createCell( 1 );
		cell801.setCellValue( new HSSFRichTextString( "" ) );
		cell801.setCellStyle( centerstyle );
		HSSFCell cell802 = row9.createCell( 2 );
		cell802.setCellValue( new HSSFRichTextString( "" ) );
		cell802.setCellStyle( centerstyle );
		HSSFCell cell803 = row9.createCell( 3 );
		cell803.setCellValue( new HSSFRichTextString( "" ) );
		cell803.setCellStyle( centerstyle );
		HSSFCell cell804 = row9.createCell( 4 );
		cell804.setCellValue( new HSSFRichTextString( "" ) );
		cell804.setCellStyle( centerstyle );
		HSSFCell cell805 = row9.createCell( 5 );
		cell805.setCellValue( new HSSFRichTextString( "" ) );
		cell805.setCellStyle( centerstyle );
		HSSFCell cell806 = row9.createCell( 6 );
		cell806.setCellValue( new HSSFRichTextString( "" ) );
		cell806.setCellStyle( centerstyle );
		HSSFCell cell807 = row9.createCell( 7 );
		cell807.setCellValue( new HSSFRichTextString( "" ) );
		cell807.setCellStyle( centerstyle );
		HSSFCell cell808 = row9.createCell( 8 );
		cell808.setCellValue( new HSSFRichTextString( "" ) );
		cell808.setCellStyle( centerstyle );
		HSSFCell cell809 = row9.createCell( 9 );
		cell809.setCellValue( new HSSFRichTextString( "" ) );
		cell809.setCellStyle( centerstyle );
		HSSFCell cell810 = row9.createCell( 10 );
		cell810.setCellValue( new HSSFRichTextString( "" ) );
		cell810.setCellStyle( centerstyle );
		HSSFCell cell811 = row9.createCell( 11 );
		cell811.setCellValue( new HSSFRichTextString( "" ) );
		cell811.setCellStyle( centerstyle );
		HSSFCell cell812 = row9.createCell( 12 );
		cell812.setCellValue( new HSSFRichTextString( "" ) );
		cell812.setCellStyle( centerstyle );
		HSSFCell cell813 = row9.createCell( 13 );
		cell813.setCellValue( new HSSFRichTextString( "" ) );
		cell813.setCellStyle( centerstyle );
		HSSFCell cell814 = row9.createCell( 14 );
		cell814.setCellValue( new HSSFRichTextString( "" ) );
		cell814.setCellStyle( centerstyle );
		HSSFCell cell815 = row9.createCell( 15 );
		cell815.setCellValue( new HSSFRichTextString( "" ) );
		cell815.setCellStyle( centerstyle );
		sheet.addMergedRegion( new CellRangeAddress( 8 + num + fyLength, 8 + num + fyLength, 0, 15 ) );//合并
		return 8 + num + fyLength;
	}

	@Override
	public List<Bx> getList(Integer userId, Integer bxlx, Integer shzt) {
		return baseMapper.getList( userId, bxlx, shzt );
	}

	@Override
	public Workbook exportBx(ExpenseAccount expenseAccount) {
		List<BxExcel> bxExcels = baseMapper.exportBx(expenseAccount);
		Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null,"报销信息", ExcelType.XSSF), BxExcel.class, bxExcels);
		return workbook;
	}


	@SuppressWarnings("unchecked")//克隆对象（深度克隆）
	public static <T> List<T> deepCopyList(List<T> src) {
		List<T> dest = null;
		try {
			ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
			ObjectOutputStream out = new ObjectOutputStream( byteOut );
			out.writeObject( src );
			ByteArrayInputStream byteIn = new ByteArrayInputStream( byteOut.toByteArray() );
			ObjectInputStream in = new ObjectInputStream( byteIn );
			dest = (List<T>) in.readObject();
		} catch (IOException e) {
		} catch (ClassNotFoundException e) {
		}
		return dest;
	}
}

